Commit aa03fc2e authored by Nick Thomas's avatar Nick Thomas

Merge branch 'fix_clusters_specs_2_7_keyword' into 'master'

Fix Ruby 2.7 keyword parameter warning in Cluster specs

See merge request gitlab-org/gitlab!43512
parents e07e69c1 ad4ea8b5
...@@ -17,11 +17,9 @@ RSpec.describe API::ProjectClusters do ...@@ -17,11 +17,9 @@ RSpec.describe API::ProjectClusters do
stub_kubeclient_get_secret( stub_kubeclient_get_secret(
api_url, api_url,
{
metadata_name: "#{namespace}-token", metadata_name: "#{namespace}-token",
token: Base64.encode64('sample-token'), token: Base64.encode64('sample-token'),
namespace: namespace namespace: namespace
}
) )
stub_kubeclient_put_secret(api_url, "#{namespace}-token", namespace: namespace) stub_kubeclient_put_secret(api_url, "#{namespace}-token", namespace: namespace)
......
...@@ -206,7 +206,7 @@ RSpec.describe Projects::Serverless::FunctionsController do ...@@ -206,7 +206,7 @@ RSpec.describe Projects::Serverless::FunctionsController do
context 'on Knative 0.5.0' do context 'on Knative 0.5.0' do
before do before do
prepare_knative_stubs(knative_05_service(knative_stub_options)) prepare_knative_stubs(knative_05_service(**knative_stub_options))
end end
include_examples 'GET #show with valid data' include_examples 'GET #show with valid data'
...@@ -214,7 +214,7 @@ RSpec.describe Projects::Serverless::FunctionsController do ...@@ -214,7 +214,7 @@ RSpec.describe Projects::Serverless::FunctionsController do
context 'on Knative 0.6.0' do context 'on Knative 0.6.0' do
before do before do
prepare_knative_stubs(knative_06_service(knative_stub_options)) prepare_knative_stubs(knative_06_service(**knative_stub_options))
end end
include_examples 'GET #show with valid data' include_examples 'GET #show with valid data'
...@@ -222,7 +222,7 @@ RSpec.describe Projects::Serverless::FunctionsController do ...@@ -222,7 +222,7 @@ RSpec.describe Projects::Serverless::FunctionsController do
context 'on Knative 0.7.0' do context 'on Knative 0.7.0' do
before do before do
prepare_knative_stubs(knative_07_service(knative_stub_options)) prepare_knative_stubs(knative_07_service(**knative_stub_options))
end end
include_examples 'GET #show with valid data' include_examples 'GET #show with valid data'
...@@ -230,7 +230,7 @@ RSpec.describe Projects::Serverless::FunctionsController do ...@@ -230,7 +230,7 @@ RSpec.describe Projects::Serverless::FunctionsController do
context 'on Knative 0.9.0' do context 'on Knative 0.9.0' do
before do before do
prepare_knative_stubs(knative_09_service(knative_stub_options)) prepare_knative_stubs(knative_09_service(**knative_stub_options))
end end
include_examples 'GET #show with valid data' include_examples 'GET #show with valid data'
...@@ -275,7 +275,7 @@ RSpec.describe Projects::Serverless::FunctionsController do ...@@ -275,7 +275,7 @@ RSpec.describe Projects::Serverless::FunctionsController do
context 'on Knative 0.5.0' do context 'on Knative 0.5.0' do
before do before do
prepare_knative_stubs(knative_05_service(knative_stub_options)) prepare_knative_stubs(knative_05_service(**knative_stub_options))
end end
include_examples 'GET #index with data' include_examples 'GET #index with data'
...@@ -283,7 +283,7 @@ RSpec.describe Projects::Serverless::FunctionsController do ...@@ -283,7 +283,7 @@ RSpec.describe Projects::Serverless::FunctionsController do
context 'on Knative 0.6.0' do context 'on Knative 0.6.0' do
before do before do
prepare_knative_stubs(knative_06_service(knative_stub_options)) prepare_knative_stubs(knative_06_service(**knative_stub_options))
end end
include_examples 'GET #index with data' include_examples 'GET #index with data'
...@@ -291,7 +291,7 @@ RSpec.describe Projects::Serverless::FunctionsController do ...@@ -291,7 +291,7 @@ RSpec.describe Projects::Serverless::FunctionsController do
context 'on Knative 0.7.0' do context 'on Knative 0.7.0' do
before do before do
prepare_knative_stubs(knative_07_service(knative_stub_options)) prepare_knative_stubs(knative_07_service(**knative_stub_options))
end end
include_examples 'GET #index with data' include_examples 'GET #index with data'
...@@ -299,7 +299,7 @@ RSpec.describe Projects::Serverless::FunctionsController do ...@@ -299,7 +299,7 @@ RSpec.describe Projects::Serverless::FunctionsController do
context 'on Knative 0.9.0' do context 'on Knative 0.9.0' do
before do before do
prepare_knative_stubs(knative_09_service(knative_stub_options)) prepare_knative_stubs(knative_09_service(**knative_stub_options))
end end
include_examples 'GET #index with data' include_examples 'GET #index with data'
......
...@@ -84,11 +84,9 @@ RSpec.describe Clusters::Gcp::FinalizeCreationService, '#execute' do ...@@ -84,11 +84,9 @@ RSpec.describe Clusters::Gcp::FinalizeCreationService, '#execute' do
before do before do
stub_cloud_platform_get_zone_cluster( stub_cloud_platform_get_zone_cluster(
provider.gcp_project_id, provider.zone, cluster.name, provider.gcp_project_id, provider.zone, cluster.name,
{
endpoint: endpoint, endpoint: endpoint,
username: username, username: username,
password: password password: password
}
) )
stub_kubeclient_discover(api_url) stub_kubeclient_discover(api_url)
...@@ -101,11 +99,9 @@ RSpec.describe Clusters::Gcp::FinalizeCreationService, '#execute' do ...@@ -101,11 +99,9 @@ RSpec.describe Clusters::Gcp::FinalizeCreationService, '#execute' do
stub_kubeclient_get_secret( stub_kubeclient_get_secret(
api_url, api_url,
{
metadata_name: secret_name, metadata_name: secret_name,
token: Base64.encode64(token), token: Base64.encode64(token),
namespace: 'default' namespace: 'default'
}
) )
stub_kubeclient_put_cluster_role_binding(api_url, 'gitlab-admin') stub_kubeclient_put_cluster_role_binding(api_url, 'gitlab-admin')
......
...@@ -26,27 +26,21 @@ RSpec.describe Clusters::Kubernetes::ConfigureIstioIngressService, '#execute' do ...@@ -26,27 +26,21 @@ RSpec.describe Clusters::Kubernetes::ConfigureIstioIngressService, '#execute' do
stub_kubeclient_get_secret( stub_kubeclient_get_secret(
api_url, api_url,
{
metadata_name: "#{namespace}-token", metadata_name: "#{namespace}-token",
token: Base64.encode64('sample-token'), token: Base64.encode64('sample-token'),
namespace: namespace namespace: namespace
}
) )
stub_kubeclient_get_secret( stub_kubeclient_get_secret(
api_url, api_url,
{
metadata_name: 'istio-ingressgateway-ca-certs', metadata_name: 'istio-ingressgateway-ca-certs',
namespace: 'istio-system' namespace: 'istio-system'
}
) )
stub_kubeclient_get_secret( stub_kubeclient_get_secret(
api_url, api_url,
{
metadata_name: 'istio-ingressgateway-certs', metadata_name: 'istio-ingressgateway-certs',
namespace: 'istio-system' namespace: 'istio-system'
}
) )
stub_kubeclient_put_secret(api_url, 'istio-ingressgateway-ca-certs', namespace: 'istio-system') stub_kubeclient_put_secret(api_url, 'istio-ingressgateway-ca-certs', namespace: 'istio-system')
......
...@@ -41,11 +41,9 @@ RSpec.describe Clusters::Kubernetes::CreateOrUpdateNamespaceService, '#execute' ...@@ -41,11 +41,9 @@ RSpec.describe Clusters::Kubernetes::CreateOrUpdateNamespaceService, '#execute'
stub_kubeclient_get_secret( stub_kubeclient_get_secret(
api_url, api_url,
{
metadata_name: "#{namespace}-token", metadata_name: "#{namespace}-token",
token: Base64.encode64('sample-token'), token: Base64.encode64('sample-token'),
namespace: namespace namespace: namespace
}
) )
end end
......
...@@ -31,11 +31,9 @@ RSpec.describe Clusters::Kubernetes::FetchKubernetesTokenService do ...@@ -31,11 +31,9 @@ RSpec.describe Clusters::Kubernetes::FetchKubernetesTokenService do
before do before do
stub_kubeclient_get_secret( stub_kubeclient_get_secret(
api_url, api_url,
{
metadata_name: service_account_token_name, metadata_name: service_account_token_name,
namespace: namespace, namespace: namespace,
token: token token: token
}
) )
end end
...@@ -54,11 +52,9 @@ RSpec.describe Clusters::Kubernetes::FetchKubernetesTokenService do ...@@ -54,11 +52,9 @@ RSpec.describe Clusters::Kubernetes::FetchKubernetesTokenService do
before do before do
stub_kubeclient_get_secret_not_found_then_found( stub_kubeclient_get_secret_not_found_then_found(
api_url, api_url,
{
metadata_name: service_account_token_name, metadata_name: service_account_token_name,
namespace: namespace, namespace: namespace,
token: token token: token
}
) )
end end
...@@ -96,11 +92,9 @@ RSpec.describe Clusters::Kubernetes::FetchKubernetesTokenService do ...@@ -96,11 +92,9 @@ RSpec.describe Clusters::Kubernetes::FetchKubernetesTokenService do
before do before do
stub_kubeclient_get_secret( stub_kubeclient_get_secret(
api_url, api_url,
{
metadata_name: service_account_token_name, metadata_name: service_account_token_name,
namespace: namespace, namespace: namespace,
token: nil token: nil
}
) )
end end
......
...@@ -24,7 +24,7 @@ module GoogleApi ...@@ -24,7 +24,7 @@ module GoogleApi
def stub_cloud_platform_get_zone_cluster(project_id, zone, cluster_id, **options) def stub_cloud_platform_get_zone_cluster(project_id, zone, cluster_id, **options)
WebMock.stub_request(:get, cloud_platform_get_zone_cluster_url(project_id, zone, cluster_id)) WebMock.stub_request(:get, cloud_platform_get_zone_cluster_url(project_id, zone, cluster_id))
.to_return(cloud_platform_response(cloud_platform_cluster_body(options))) .to_return(cloud_platform_response(cloud_platform_cluster_body(**options)))
end end
def stub_cloud_platform_get_zone_cluster_error(project_id, zone, cluster_id) def stub_cloud_platform_get_zone_cluster_error(project_id, zone, cluster_id)
......
...@@ -153,7 +153,7 @@ module KubernetesHelpers ...@@ -153,7 +153,7 @@ module KubernetesHelpers
options[:name] ||= "kubetest" options[:name] ||= "kubetest"
options[:domain] ||= "example.com" options[:domain] ||= "example.com"
options[:response] ||= kube_response(kube_knative_services_body(options)) options[:response] ||= kube_response(kube_knative_services_body(**options))
stub_kubeclient_discover(service.api_url) stub_kubeclient_discover(service.api_url)
...@@ -167,7 +167,7 @@ module KubernetesHelpers ...@@ -167,7 +167,7 @@ module KubernetesHelpers
options[:namespace] ||= "default" options[:namespace] ||= "default"
WebMock.stub_request(:get, api_url + "/api/v1/namespaces/#{options[:namespace]}/secrets/#{options[:metadata_name]}") WebMock.stub_request(:get, api_url + "/api/v1/namespaces/#{options[:namespace]}/secrets/#{options[:metadata_name]}")
.to_return(kube_response(kube_v1_secret_body(options))) .to_return(kube_response(kube_v1_secret_body(**options)))
end end
def stub_kubeclient_get_secret_error(api_url, name, namespace: 'default', status: 404) def stub_kubeclient_get_secret_error(api_url, name, namespace: 'default', status: 404)
...@@ -517,7 +517,7 @@ module KubernetesHelpers ...@@ -517,7 +517,7 @@ module KubernetesHelpers
def kube_knative_services_body(**options) def kube_knative_services_body(**options)
{ {
"kind" => "List", "kind" => "List",
"items" => [knative_09_service(options)] "items" => [knative_09_service(**options)]
} }
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment