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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 18:40:28 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 18:40:28 +0300
commitb595cb0c1dec83de5bdee18284abe86614bed33b (patch)
tree8c3d4540f193c5ff98019352f554e921b3a41a72 /spec/models/clusters
parent2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff)
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'spec/models/clusters')
-rw-r--r--spec/models/clusters/applications/elastic_stack_spec.rb177
-rw-r--r--spec/models/clusters/cluster_spec.rb17
-rw-r--r--spec/models/clusters/integrations/elastic_stack_spec.rb19
-rw-r--r--spec/models/clusters/integrations/prometheus_spec.rb26
4 files changed, 0 insertions, 239 deletions
diff --git a/spec/models/clusters/applications/elastic_stack_spec.rb b/spec/models/clusters/applications/elastic_stack_spec.rb
deleted file mode 100644
index af2802d5e47..00000000000
--- a/spec/models/clusters/applications/elastic_stack_spec.rb
+++ /dev/null
@@ -1,177 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe Clusters::Applications::ElasticStack do
- include KubernetesHelpers
-
- include_examples 'cluster application core specs', :clusters_applications_elastic_stack
- include_examples 'cluster application status specs', :clusters_applications_elastic_stack
- include_examples 'cluster application version specs', :clusters_applications_elastic_stack
- include_examples 'cluster application helm specs', :clusters_applications_elastic_stack
-
- describe 'cluster.integration_elastic_stack state synchronization' do
- let!(:application) { create(:clusters_applications_elastic_stack) }
- let(:cluster) { application.cluster }
- let(:integration) { cluster.integration_elastic_stack }
-
- describe 'after_destroy' do
- it 'disables the corresponding integration' do
- application.destroy!
-
- expect(integration).not_to be_enabled
- end
- end
-
- describe 'on install' do
- it 'enables the corresponding integration' do
- application.make_scheduled!
- application.make_installing!
- application.make_installed!
-
- expect(integration).to be_enabled
- end
- end
-
- describe 'on uninstall' do
- it 'disables the corresponding integration' do
- application.make_scheduled!
- application.make_installing!
- application.make_installed!
- application.make_externally_uninstalled!
-
- expect(integration).not_to be_enabled
- end
- end
- end
-
- describe '#install_command' do
- let!(:elastic_stack) { create(:clusters_applications_elastic_stack) }
-
- subject { elastic_stack.install_command }
-
- it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::InstallCommand) }
-
- it 'is initialized with elastic stack arguments' do
- expect(subject.name).to eq('elastic-stack')
- expect(subject.chart).to eq('elastic-stack/elastic-stack')
- expect(subject.version).to eq('3.0.0')
- expect(subject.repository).to eq('https://charts.gitlab.io')
- expect(subject).to be_rbac
- expect(subject.files).to eq(elastic_stack.files)
- expect(subject.preinstall).to be_empty
- end
-
- context 'within values.yaml' do
- let(:values_yaml_content) {subject.files[:"values.yaml"]}
-
- it 'contains the disabled index lifecycle management' do
- expect(values_yaml_content).to include "setup.ilm.enabled: false"
- end
-
- it 'contains daily indices with respective template' do
- expect(values_yaml_content).to include "index: \"filebeat-%{[agent.version]}-%{+yyyy.MM.dd}\""
- expect(values_yaml_content).to include "setup.template.name: 'filebeat'"
- expect(values_yaml_content).to include "setup.template.pattern: 'filebeat-*'"
- end
- end
-
- context 'on a non rbac enabled cluster' do
- before do
- elastic_stack.cluster.platform_kubernetes.abac!
- end
-
- it { is_expected.not_to be_rbac }
- end
-
- context 'on versions older than 2' do
- before do
- elastic_stack.status = elastic_stack.status_states[:updating]
- elastic_stack.version = "1.9.0"
- end
-
- it 'includes a preinstall script' do
- expect(subject.preinstall).not_to be_empty
- expect(subject.preinstall.first).to include("helm uninstall")
- end
- end
-
- context 'on versions older than 3' do
- before do
- elastic_stack.status = elastic_stack.status_states[:updating]
- elastic_stack.version = "2.9.0"
- end
-
- it 'includes a preinstall script' do
- expect(subject.preinstall).not_to be_empty
- expect(subject.preinstall.first).to include("helm uninstall")
- end
- end
-
- context 'application failed to install previously' do
- let(:elastic_stack) { create(:clusters_applications_elastic_stack, :errored, version: '0.0.1') }
-
- it 'is initialized with the locked version' do
- expect(subject.version).to eq('3.0.0')
- end
- end
- end
-
- describe '#chart_above_v2?' do
- let(:elastic_stack) { create(:clusters_applications_elastic_stack, version: version) }
-
- subject { elastic_stack.chart_above_v2? }
-
- context 'on v1.9.0' do
- let(:version) { '1.9.0' }
-
- it { is_expected.to be_falsy }
- end
-
- context 'on v2.0.0' do
- let(:version) { '2.0.0' }
-
- it { is_expected.to be_truthy }
- end
- end
-
- describe '#chart_above_v3?' do
- let(:elastic_stack) { create(:clusters_applications_elastic_stack, version: version) }
-
- subject { elastic_stack.chart_above_v3? }
-
- context 'on v1.9.0' do
- let(:version) { '1.9.0' }
-
- it { is_expected.to be_falsy }
- end
-
- context 'on v3.0.0' do
- let(:version) { '3.0.0' }
-
- it { is_expected.to be_truthy }
- end
- end
-
- describe '#uninstall_command' do
- let!(:elastic_stack) { create(:clusters_applications_elastic_stack) }
-
- subject { elastic_stack.uninstall_command }
-
- it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::DeleteCommand) }
-
- it 'is initialized with elastic stack arguments' do
- expect(subject.name).to eq('elastic-stack')
- expect(subject).to be_rbac
- expect(subject.files).to eq(elastic_stack.files)
- end
-
- it 'specifies a post delete command to remove custom resource definitions' do
- expect(subject.postdelete).to eq([
- 'kubectl delete pvc --selector app\\=elastic-stack-elasticsearch-master --namespace gitlab-managed-apps'
- ])
- end
- end
-
- it_behaves_like 'cluster-based #elasticsearch_client', :clusters_applications_elastic_stack
-end
diff --git a/spec/models/clusters/cluster_spec.rb b/spec/models/clusters/cluster_spec.rb
index 30591a3ff5d..65ead01a2bd 100644
--- a/spec/models/clusters/cluster_spec.rb
+++ b/spec/models/clusters/cluster_spec.rb
@@ -42,7 +42,6 @@ RSpec.describe Clusters::Cluster, :use_clean_rails_memory_store_caching do
it { is_expected.to delegate_method(:available?).to(:application_helm).with_prefix }
it { is_expected.to delegate_method(:available?).to(:application_ingress).with_prefix }
it { is_expected.to delegate_method(:available?).to(:application_knative).with_prefix }
- it { is_expected.to delegate_method(:available?).to(:integration_elastic_stack).with_prefix }
it { is_expected.to delegate_method(:available?).to(:integration_prometheus).with_prefix }
it { is_expected.to delegate_method(:external_ip).to(:application_ingress).with_prefix }
it { is_expected.to delegate_method(:external_hostname).to(:application_ingress).with_prefix }
@@ -200,22 +199,6 @@ RSpec.describe Clusters::Cluster, :use_clean_rails_memory_store_caching do
end
end
- describe '.with_available_elasticstack' do
- subject { described_class.with_available_elasticstack }
-
- let_it_be(:cluster) { create(:cluster) }
-
- context 'cluster has ElasticStack application' do
- let!(:application) { create(:clusters_applications_elastic_stack, :installed, cluster: cluster) }
-
- it { is_expected.to include(cluster) }
- end
-
- context 'cluster does not have ElasticStack application' do
- it { is_expected.not_to include(cluster) }
- end
- end
-
describe '.distinct_with_deployed_environments' do
subject { described_class.distinct_with_deployed_environments }
diff --git a/spec/models/clusters/integrations/elastic_stack_spec.rb b/spec/models/clusters/integrations/elastic_stack_spec.rb
deleted file mode 100644
index be4d59b52a2..00000000000
--- a/spec/models/clusters/integrations/elastic_stack_spec.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe Clusters::Integrations::ElasticStack do
- include KubernetesHelpers
- include StubRequests
-
- describe 'associations' do
- it { is_expected.to belong_to(:cluster).class_name('Clusters::Cluster') }
- end
-
- describe 'validations' do
- it { is_expected.to validate_presence_of(:cluster) }
- it { is_expected.not_to allow_value(nil).for(:enabled) }
- end
-
- it_behaves_like 'cluster-based #elasticsearch_client', :clusters_integrations_elastic_stack
-end
diff --git a/spec/models/clusters/integrations/prometheus_spec.rb b/spec/models/clusters/integrations/prometheus_spec.rb
index d1e40fffee0..90e99aefdce 100644
--- a/spec/models/clusters/integrations/prometheus_spec.rb
+++ b/spec/models/clusters/integrations/prometheus_spec.rb
@@ -26,19 +26,6 @@ RSpec.describe Clusters::Integrations::Prometheus do
integration.destroy!
end
-
- context 'when the FF :rename_integrations_workers is disabled' do
- before do
- stub_feature_flags(rename_integrations_workers: false)
- end
-
- it 'uses the old worker' do
- expect(Clusters::Applications::DeactivateServiceWorker)
- .to receive(:perform_async).with(cluster.id, 'prometheus')
-
- integration.destroy!
- end
- end
end
describe 'after_save' do
@@ -70,19 +57,6 @@ RSpec.describe Clusters::Integrations::Prometheus do
integration.update!(enabled: true)
end
-
- context 'when the FF :rename_integrations_workers is disabled' do
- before do
- stub_feature_flags(rename_integrations_workers: false)
- end
-
- it 'uses the old worker' do
- expect(Clusters::Applications::ActivateServiceWorker)
- .to receive(:perform_async).with(cluster.id, 'prometheus')
-
- integration.update!(enabled: true)
- end
- end
end
context 'when disabling' do