diff options
Diffstat (limited to 'spec/support/prometheus/additional_metrics_shared_examples.rb')
-rw-r--r-- | spec/support/prometheus/additional_metrics_shared_examples.rb | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/spec/support/prometheus/additional_metrics_shared_examples.rb b/spec/support/prometheus/additional_metrics_shared_examples.rb index 620fa37d455..dbbd4ad4d40 100644 --- a/spec/support/prometheus/additional_metrics_shared_examples.rb +++ b/spec/support/prometheus/additional_metrics_shared_examples.rb @@ -41,16 +41,30 @@ RSpec.shared_examples 'additional metrics query' do end describe 'project has Kubernetes service' do - let(:project) { create(:kubernetes_project) } - let(:environment) { create(:environment, slug: 'environment-slug', project: project) } - let(:kube_namespace) { project.kubernetes_service.actual_namespace } + shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do + let(:environment) { create(:environment, slug: 'environment-slug', project: project) } + let(:kube_namespace) { project.deployment_platform.actual_namespace } - it_behaves_like 'query context containing environment slug and filter' + it_behaves_like 'query context containing environment slug and filter' - it 'query context contains kube_namespace' do - expect(subject).to receive(:query_metrics).with(hash_including(kube_namespace: kube_namespace)) + it 'query context contains kube_namespace' do + expect(subject).to receive(:query_metrics).with(hash_including(kube_namespace: kube_namespace)) - subject.query(*query_params) + subject.query(*query_params) + end + end + + context 'when user configured kubernetes from Integration > Kubernetes' do + let(:project) { create(:kubernetes_project) } + + it_behaves_like 'same behavior between KubernetesService and Platform::Kubernetes' + end + + context 'when user configured kubernetes from CI/CD > Clusters' do + let!(:cluster) { create(:cluster, :project, :provided_by_gcp) } + let(:project) { cluster.project } + + it_behaves_like 'same behavior between KubernetesService and Platform::Kubernetes' end end |