Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-09 23:05:40 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-09 23:05:40 +0300
commit3586a30ca5035c95943fd7b99809032bd0ef8505 (patch)
tree0af521d3b04633206da127d32df5168444e81fce /spec
parent9fc86114fb1d573d5b1b45986472f9beee83d50d (diff)
Add latest changes from gitlab-org/gitlab@12-6-stable-ee
Diffstat (limited to 'spec')
-rw-r--r--spec/features/boards/sidebar_spec.rb1
-rw-r--r--spec/features/projects/releases/user_views_releases_spec.rb10
-rw-r--r--spec/finders/clusters/knative_serving_namespace_finder_spec.rb55
-rw-r--r--spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb58
-rw-r--r--spec/lib/gitlab/ci/yaml_processor_spec.rb13
-rw-r--r--spec/lib/gitlab/metrics/prometheus_spec.rb21
-rw-r--r--spec/lib/gitlab/plugin_spec.rb57
-rw-r--r--spec/models/project_spec.rb7
-rw-r--r--spec/presenters/release_presenter_spec.rb24
-rw-r--r--spec/requests/api/releases_spec.rb10
-rw-r--r--spec/services/ci/find_exposed_artifacts_service_spec.rb29
-rw-r--r--spec/services/clusters/aws/provision_service_spec.rb2
-rw-r--r--spec/services/clusters/kubernetes/create_or_update_namespace_service_spec.rb4
-rw-r--r--spec/services/clusters/kubernetes/create_or_update_service_account_service_spec.rb27
-rw-r--r--spec/services/clusters/kubernetes_spec.rb3
-rw-r--r--spec/support/helpers/kubernetes_helpers.rb31
16 files changed, 169 insertions, 183 deletions
diff --git a/spec/features/boards/sidebar_spec.rb b/spec/features/boards/sidebar_spec.rb
index 2b923df40c5..9143db16b87 100644
--- a/spec/features/boards/sidebar_spec.rb
+++ b/spec/features/boards/sidebar_spec.rb
@@ -318,6 +318,7 @@ describe 'Issue Boards', :js do
wait_for_requests
click_link bug.title
+ within('.dropdown-menu-labels') { expect(page).to have_selector('.is-active', count: 3) }
click_link regression.title
wait_for_requests
diff --git a/spec/features/projects/releases/user_views_releases_spec.rb b/spec/features/projects/releases/user_views_releases_spec.rb
index a9b8ff9dc4d..4507d90576b 100644
--- a/spec/features/projects/releases/user_views_releases_spec.rb
+++ b/spec/features/projects/releases/user_views_releases_spec.rb
@@ -57,4 +57,14 @@ describe 'User views releases', :js do
expect(page).to have_content('Upcoming Release')
end
end
+
+ context 'with a tag containing a slash' do
+ it 'sees the release' do
+ release = create :release, :with_evidence, project: project, tag: 'debian/2.4.0-1'
+ visit project_releases_path(project)
+
+ expect(page).to have_content(release.name)
+ expect(page).to have_content(release.tag)
+ end
+ end
end
diff --git a/spec/finders/clusters/knative_serving_namespace_finder_spec.rb b/spec/finders/clusters/knative_serving_namespace_finder_spec.rb
deleted file mode 100644
index f3587df680a..00000000000
--- a/spec/finders/clusters/knative_serving_namespace_finder_spec.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-describe Clusters::KnativeServingNamespaceFinder do
- include KubernetesHelpers
- let(:cluster) { create(:cluster, :project, :provided_by_gcp) }
- let(:service) { environment.deployment_platform }
- let(:project) { cluster.cluster_project.project }
- let(:environment) { create(:environment, project: project) }
-
- subject { described_class.new(cluster) }
-
- before do
- stub_kubeclient_discover(service.api_url)
- end
-
- it 'finds the namespace in a cluster where it exists' do
- stub_kubeclient_get_namespace(service.api_url, namespace: Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE)
- expect(subject.execute).to be_a Kubeclient::Resource
- end
-
- it 'returns nil in a cluster where it does not' do
- stub_kubeclient_get_namespace(
- service.api_url,
- namespace: Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE,
- response: {
- status: [404, "Resource Not Found"]
- }
- )
- expect(subject.execute).to be nil
- end
-
- it 'returns nil in a cluster where the lookup results in a 403 as it will in some versions of kubernetes' do
- stub_kubeclient_get_namespace(
- service.api_url,
- namespace: Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE,
- response: {
- status: [403, "Resource Not Found"]
- }
- )
- expect(subject.execute).to be nil
- end
-
- it 'raises an error if error code is not 404 or 403' do
- stub_kubeclient_get_namespace(
- service.api_url,
- namespace: Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE,
- response: {
- status: [500, "Internal Server Error"]
- }
- )
- expect { subject.execute }.to raise_error(Kubeclient::HttpError)
- end
-end
diff --git a/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb b/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb
index 2493855f851..66240380edd 100644
--- a/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb
+++ b/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb
@@ -38,44 +38,12 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do
.and_return(double(execute: kubernetes_namespace))
end
- context 'and the knative-serving namespace is missing' do
- before do
- allow(Clusters::KnativeServingNamespaceFinder).to receive(:new)
- .and_return(double(execute: false))
- end
-
- it { is_expected.to be_truthy }
- end
-
- context 'and the knative-serving namespace exists' do
- before do
- allow(Clusters::KnativeServingNamespaceFinder).to receive(:new)
- .and_return(double(execute: true))
- end
-
- context 'and the knative version role binding is missing' do
- before do
- allow(Clusters::KnativeVersionRoleBindingFinder).to receive(:new)
- .and_return(double(execute: nil))
- end
-
- it { is_expected.to be_truthy }
- end
-
- context 'and the knative version role binding already exists' do
- before do
- allow(Clusters::KnativeVersionRoleBindingFinder).to receive(:new)
- .and_return(double(execute: true))
- end
-
- it { is_expected.to be_falsey }
+ it { is_expected.to be_falsey }
- context 'and the service_account_token is blank' do
- let(:kubernetes_namespace) { instance_double(Clusters::KubernetesNamespace, service_account_token: nil) }
+ context 'and the service_account_token is blank' do
+ let(:kubernetes_namespace) { instance_double(Clusters::KubernetesNamespace, service_account_token: nil) }
- it { is_expected.to be_truthy }
- end
- end
+ it { is_expected.to be_truthy }
end
end
end
@@ -188,24 +156,6 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do
subject
end
end
-
- context 'knative version role binding is missing' do
- before do
- allow(Clusters::KubernetesNamespaceFinder).to receive(:new)
- .and_return(double(execute: kubernetes_namespace))
- allow(Clusters::KnativeVersionRoleBindingFinder).to receive(:new)
- .and_return(double(execute: nil))
- end
-
- it 'creates the knative version role binding' do
- expect(Clusters::Kubernetes::CreateOrUpdateNamespaceService)
- .to receive(:new)
- .with(cluster: cluster, kubernetes_namespace: kubernetes_namespace)
- .and_return(service)
-
- subject
- end
- end
end
context 'completion is not required' do
diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb
index 8f9c5c74260..fea8073f999 100644
--- a/spec/lib/gitlab/ci/yaml_processor_spec.rb
+++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb
@@ -1255,6 +1255,19 @@ module Gitlab
expect(builds.first[:options][:artifacts][:when]).to eq(when_state)
end
end
+
+ it "gracefully handles errors in artifacts type" do
+ config = <<~YAML
+ test:
+ script:
+ - echo "Hello world"
+ artifacts:
+ - paths:
+ - test/
+ YAML
+
+ expect { described_class.new(config) }.to raise_error(described_class::ValidationError)
+ end
end
describe '#environment' do
diff --git a/spec/lib/gitlab/metrics/prometheus_spec.rb b/spec/lib/gitlab/metrics/prometheus_spec.rb
index b37624982e2..e15a063fc9e 100644
--- a/spec/lib/gitlab/metrics/prometheus_spec.rb
+++ b/spec/lib/gitlab/metrics/prometheus_spec.rb
@@ -6,6 +6,10 @@ describe Gitlab::Metrics::Prometheus, :prometheus do
let(:all_metrics) { Gitlab::Metrics }
let(:registry) { all_metrics.registry }
+ after do
+ all_metrics.clear_errors!
+ end
+
describe '#reset_registry!' do
it 'clears existing metrics' do
registry.counter(:test, 'test metric')
@@ -17,4 +21,21 @@ describe Gitlab::Metrics::Prometheus, :prometheus do
expect(all_metrics.registry.metrics.count).to eq(0)
end
end
+
+ describe '#error_detected!' do
+ before do
+ allow(all_metrics).to receive(:metrics_folder_present?).and_return(true)
+ stub_application_setting(prometheus_metrics_enabled: true)
+ end
+
+ it 'disables Prometheus metrics' do
+ expect(all_metrics.error?).to be_falsey
+ expect(all_metrics.prometheus_metrics_enabled?).to be_truthy
+
+ all_metrics.error_detected!
+
+ expect(all_metrics.prometheus_metrics_enabled?).to be_falsey
+ expect(all_metrics.error?).to be_truthy
+ end
+ end
end
diff --git a/spec/lib/gitlab/plugin_spec.rb b/spec/lib/gitlab/plugin_spec.rb
index a8ddd774f3f..5d9f6d04caa 100644
--- a/spec/lib/gitlab/plugin_spec.rb
+++ b/spec/lib/gitlab/plugin_spec.rb
@@ -3,22 +3,59 @@
require 'spec_helper'
describe Gitlab::Plugin do
+ let(:plugin) { Rails.root.join('plugins', 'test.rb') }
+ let(:tmp_file) { Tempfile.new('plugin-dump') }
+
+ let(:plugin_source) do
+ <<~EOS
+ #!/usr/bin/env ruby
+ x = STDIN.read
+ File.write('#{tmp_file.path}', x)
+ EOS
+ end
+
+ context 'with plugins present' do
+ before do
+ File.write(plugin, plugin_source)
+ end
+
+ after do
+ FileUtils.rm(plugin)
+ end
+
+ describe '.any?' do
+ it 'returns true' do
+ expect(described_class.any?).to be true
+ end
+ end
+
+ describe '.files?' do
+ it 'returns a list of plugins' do
+ expect(described_class.files).to match_array([plugin.to_s])
+ end
+ end
+ end
+
+ context 'without any plugins' do
+ describe '.any?' do
+ it 'returns false' do
+ expect(described_class.any?).to be false
+ end
+ end
+
+ describe '.files' do
+ it 'returns an empty list' do
+ expect(described_class.files).to be_empty
+ end
+ end
+ end
+
describe '.execute' do
let(:data) { Gitlab::DataBuilder::Push::SAMPLE_DATA }
- let(:plugin) { Rails.root.join('plugins', 'test.rb') }
- let(:tmp_file) { Tempfile.new('plugin-dump') }
let(:result) { described_class.execute(plugin.to_s, data) }
let(:success) { result.first }
let(:message) { result.last }
- let(:plugin_source) do
- <<~EOS
- #!/usr/bin/env ruby
- x = STDIN.read
- File.write('#{tmp_file.path}', x)
- EOS
- end
-
before do
File.write(plugin, plugin_source)
end
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 99d7e4d156f..d55530bf820 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -4714,6 +4714,13 @@ describe Project do
expect(project.has_active_hooks?(:merge_request_events)).to be_falsey
expect(project.has_active_hooks?).to be_truthy
end
+
+ it 'returns true when a plugin exists' do
+ expect(Gitlab::Plugin).to receive(:any?).twice.and_return(true)
+
+ expect(project.has_active_hooks?(:merge_request_events)).to be_truthy
+ expect(project.has_active_hooks?).to be_truthy
+ end
end
describe '#has_active_services?' do
diff --git a/spec/presenters/release_presenter_spec.rb b/spec/presenters/release_presenter_spec.rb
index 2f978b0a036..4c6142f2edb 100644
--- a/spec/presenters/release_presenter_spec.rb
+++ b/spec/presenters/release_presenter_spec.rb
@@ -96,4 +96,28 @@ describe ReleasePresenter do
it { is_expected.to be_nil }
end
end
+
+ describe '#evidence_file_path' do
+ subject { presenter.evidence_file_path }
+
+ context 'without evidence' do
+ it { is_expected.to be_falsy }
+ end
+
+ context 'with evidence' do
+ let(:release) { create :release, :with_evidence, project: project }
+
+ specify do
+ is_expected.to match /#{evidence_project_release_url(project, release.tag, format: :json)}/
+ end
+ end
+
+ context 'when a tag contains a slash' do
+ let(:release) { create :release, :with_evidence, project: project, tag: 'debian/2.4.0-1' }
+
+ specify do
+ is_expected.to match /#{evidence_project_release_url(project, CGI.escape(release.tag), format: :json)}/
+ end
+ end
+ end
end
diff --git a/spec/requests/api/releases_spec.rb b/spec/requests/api/releases_spec.rb
index 233f0497b7f..d3fe4c22b1d 100644
--- a/spec/requests/api/releases_spec.rb
+++ b/spec/requests/api/releases_spec.rb
@@ -115,6 +115,16 @@ describe API::Releases do
end
end
+ context 'when tag contains a slash' do
+ let!(:release) { create(:release, project: project, tag: 'debian/2.4.0-1', description: "debian/2.4.0-1") }
+
+ it 'returns 200 HTTP status' do
+ get api("/projects/#{project.id}/releases", maintainer)
+
+ expect(response).to have_gitlab_http_status(:ok)
+ end
+ end
+
context 'when user is a guest' do
let!(:release) do
create(:release,
diff --git a/spec/services/ci/find_exposed_artifacts_service_spec.rb b/spec/services/ci/find_exposed_artifacts_service_spec.rb
index f6309822fe0..b0f190b0e7a 100644
--- a/spec/services/ci/find_exposed_artifacts_service_spec.rb
+++ b/spec/services/ci/find_exposed_artifacts_service_spec.rb
@@ -50,10 +50,39 @@ describe Ci::FindExposedArtifactsService do
end
end
+ shared_examples 'does not find any matches' do
+ it 'returns empty array' do
+ expect(subject).to eq []
+ end
+ end
+
let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
subject { described_class.new(project, user).for_pipeline(pipeline) }
+ context 'with jobs having no exposed artifacts' do
+ let!(:job) do
+ create_job_with_artifacts(artifacts: {
+ paths: ['other_artifacts_0.1.2/doc_sample.txt', 'something-else.html']
+ })
+ end
+
+ it_behaves_like 'does not find any matches'
+ end
+
+ context 'with jobs having no artifacts (metadata)' do
+ let!(:job) do
+ create(:ci_build, pipeline: pipeline, options: {
+ artifacts: {
+ expose_as: 'Exposed artifact',
+ paths: ['other_artifacts_0.1.2/doc_sample.txt', 'something-else.html']
+ }
+ })
+ end
+
+ it_behaves_like 'does not find any matches'
+ end
+
context 'with jobs having at most 1 matching exposed artifact' do
let!(:job) do
create_job_with_artifacts(artifacts: {
diff --git a/spec/services/clusters/aws/provision_service_spec.rb b/spec/services/clusters/aws/provision_service_spec.rb
index 927ffaef002..15571c64e13 100644
--- a/spec/services/clusters/aws/provision_service_spec.rb
+++ b/spec/services/clusters/aws/provision_service_spec.rb
@@ -35,7 +35,7 @@ describe Clusters::Aws::ProvisionService do
before do
allow(Clusters::Aws::FetchCredentialsService).to receive(:new)
- .with(provision_role, provider: provider, region: provider.region)
+ .with(provision_role, provider: provider)
.and_return(double(execute: credentials))
allow(provider).to receive(:api_client)
diff --git a/spec/services/clusters/kubernetes/create_or_update_namespace_service_spec.rb b/spec/services/clusters/kubernetes/create_or_update_namespace_service_spec.rb
index 5dc4a1dc0b3..bd1a90996a8 100644
--- a/spec/services/clusters/kubernetes/create_or_update_namespace_service_spec.rb
+++ b/spec/services/clusters/kubernetes/create_or_update_namespace_service_spec.rb
@@ -22,6 +22,7 @@ describe Clusters::Kubernetes::CreateOrUpdateNamespaceService, '#execute' do
before do
stub_kubeclient_discover(api_url)
+ stub_kubeclient_get_namespace(api_url)
stub_kubeclient_get_service_account_error(api_url, 'gitlab')
stub_kubeclient_create_service_account(api_url)
stub_kubeclient_get_secret_error(api_url, 'gitlab-token')
@@ -30,7 +31,6 @@ describe Clusters::Kubernetes::CreateOrUpdateNamespaceService, '#execute' do
stub_kubeclient_get_role_binding(api_url, "gitlab-#{namespace}", namespace: namespace)
stub_kubeclient_put_role_binding(api_url, "gitlab-#{namespace}", namespace: namespace)
stub_kubeclient_get_namespace(api_url, namespace: namespace)
- stub_kubeclient_get_namespace(api_url, namespace: Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE)
stub_kubeclient_get_service_account_error(api_url, "#{namespace}-service-account", namespace: namespace)
stub_kubeclient_create_service_account(api_url, namespace: namespace)
stub_kubeclient_create_secret(api_url, namespace: namespace)
@@ -39,8 +39,6 @@ describe Clusters::Kubernetes::CreateOrUpdateNamespaceService, '#execute' do
stub_kubeclient_put_role_binding(api_url, Clusters::Kubernetes::GITLAB_KNATIVE_SERVING_ROLE_BINDING_NAME, namespace: namespace)
stub_kubeclient_put_role(api_url, Clusters::Kubernetes::GITLAB_CROSSPLANE_DATABASE_ROLE_NAME, namespace: namespace)
stub_kubeclient_put_role_binding(api_url, Clusters::Kubernetes::GITLAB_CROSSPLANE_DATABASE_ROLE_BINDING_NAME, namespace: namespace)
- stub_kubeclient_put_cluster_role(api_url, Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_NAME)
- stub_kubeclient_put_cluster_role_binding(api_url, Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME)
stub_kubeclient_get_secret(
api_url,
diff --git a/spec/services/clusters/kubernetes/create_or_update_service_account_service_spec.rb b/spec/services/clusters/kubernetes/create_or_update_service_account_service_spec.rb
index 1ca3c50c46c..4df73fcc2ae 100644
--- a/spec/services/clusters/kubernetes/create_or_update_service_account_service_spec.rb
+++ b/spec/services/clusters/kubernetes/create_or_update_service_account_service_spec.rb
@@ -141,15 +141,12 @@ describe Clusters::Kubernetes::CreateOrUpdateServiceAccountService do
before do
cluster.platform_kubernetes.rbac!
- stub_kubeclient_get_namespace(api_url, namespace: Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE)
stub_kubeclient_get_role_binding_error(api_url, role_binding_name, namespace: namespace)
stub_kubeclient_create_role_binding(api_url, namespace: namespace)
stub_kubeclient_put_role(api_url, Clusters::Kubernetes::GITLAB_KNATIVE_SERVING_ROLE_NAME, namespace: namespace)
stub_kubeclient_put_role_binding(api_url, Clusters::Kubernetes::GITLAB_KNATIVE_SERVING_ROLE_BINDING_NAME, namespace: namespace)
stub_kubeclient_put_role(api_url, Clusters::Kubernetes::GITLAB_CROSSPLANE_DATABASE_ROLE_NAME, namespace: namespace)
stub_kubeclient_put_role_binding(api_url, Clusters::Kubernetes::GITLAB_CROSSPLANE_DATABASE_ROLE_BINDING_NAME, namespace: namespace)
- stub_kubeclient_put_cluster_role(api_url, Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_NAME)
- stub_kubeclient_put_cluster_role_binding(api_url, Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME)
end
it_behaves_like 'creates service account and token'
@@ -237,30 +234,6 @@ describe Clusters::Kubernetes::CreateOrUpdateServiceAccountService do
)
)
end
-
- it 'creates a role and role binding granting the ability to get the version of deployments in knative-serving namespace' do
- subject
-
- expect(WebMock).to have_requested(:put, api_url + "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/#{Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME}").with(
- body: hash_including(
- metadata: {
- name: Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME
- },
- roleRef: {
- apiGroup: "rbac.authorization.k8s.io",
- kind: "ClusterRole",
- name: Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_NAME
- },
- subjects: [
- {
- kind: "ServiceAccount",
- name: service_account_name,
- namespace: namespace
- }
- ]
- )
- )
- end
end
end
end
diff --git a/spec/services/clusters/kubernetes_spec.rb b/spec/services/clusters/kubernetes_spec.rb
index 7f2c5e0461d..09cc304debe 100644
--- a/spec/services/clusters/kubernetes_spec.rb
+++ b/spec/services/clusters/kubernetes_spec.rb
@@ -13,7 +13,4 @@ describe Clusters::Kubernetes do
it { is_expected.to be_const_defined(:GITLAB_KNATIVE_SERVING_ROLE_BINDING_NAME) }
it { is_expected.to be_const_defined(:GITLAB_CROSSPLANE_DATABASE_ROLE_NAME) }
it { is_expected.to be_const_defined(:GITLAB_CROSSPLANE_DATABASE_ROLE_BINDING_NAME) }
- it { is_expected.to be_const_defined(:GITLAB_KNATIVE_VERSION_ROLE_NAME) }
- it { is_expected.to be_const_defined(:GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME) }
- it { is_expected.to be_const_defined(:KNATIVE_SERVING_NAMESPACE) }
end
diff --git a/spec/support/helpers/kubernetes_helpers.rb b/spec/support/helpers/kubernetes_helpers.rb
index b2145ca729f..9435a0e1487 100644
--- a/spec/support/helpers/kubernetes_helpers.rb
+++ b/spec/support/helpers/kubernetes_helpers.rb
@@ -194,11 +194,6 @@ module KubernetesHelpers
.to_return(kube_response({}))
end
- def stub_kubeclient_put_cluster_role_binding(api_url, name)
- WebMock.stub_request(:put, api_url + "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/#{name}")
- .to_return(kube_response({}))
- end
-
def stub_kubeclient_get_role_binding(api_url, name, namespace: 'default')
WebMock.stub_request(:get, api_url + "/apis/rbac.authorization.k8s.io/v1/namespaces/#{namespace}/rolebindings/#{name}")
.to_return(kube_response({}))
@@ -224,18 +219,8 @@ module KubernetesHelpers
.to_return(kube_response({}))
end
- def stub_kubeclient_get_namespaces(api_url)
- WebMock.stub_request(:get, api_url + '/api/v1/namespaces')
- .to_return(kube_response(kube_v1_namespace_list_body))
- end
-
- def stub_kubeclient_get_namespace(api_url, namespace: 'default', response: kube_response({}))
+ def stub_kubeclient_get_namespace(api_url, namespace: 'default')
WebMock.stub_request(:get, api_url + "/api/v1/namespaces/#{namespace}")
- .to_return(response)
- end
-
- def stub_kubeclient_put_cluster_role(api_url, name)
- WebMock.stub_request(:put, api_url + "/apis/rbac.authorization.k8s.io/v1/clusterroles/#{name}")
.to_return(kube_response({}))
end
@@ -272,20 +257,6 @@ module KubernetesHelpers
}
end
- def kube_v1_namespace_list_body
- {
- "kind" => "NamespaceList",
- "apiVersion" => "v1",
- "items" => [
- {
- "metadata" => {
- "name" => "knative-serving"
- }
- }
- ]
- }
- end
-
def kube_v1beta1_discovery_body
{
"kind" => "APIResourceList",