summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-20 15:08:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-20 15:08:44 +0000
commitb9bac6dbf78a5a7976fba14aaeef96bdeb0da612 (patch)
treeffe277b562256f718b0818e8fd3c8fd8766d0269 /spec/support
parent8c4198cbe631278e87fee04157d23494fbb80cdb (diff)
downloadgitlab-ce-b9bac6dbf78a5a7976fba14aaeef96bdeb0da612.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/models/cluster_application_helm_cert_shared_examples.rb42
-rw-r--r--spec/support/shared_examples/models/cluster_application_status_shared_examples.rb80
2 files changed, 103 insertions, 19 deletions
diff --git a/spec/support/shared_examples/models/cluster_application_helm_cert_shared_examples.rb b/spec/support/shared_examples/models/cluster_application_helm_cert_shared_examples.rb
index d5c425dea51..fa6b0c3afdd 100644
--- a/spec/support/shared_examples/models/cluster_application_helm_cert_shared_examples.rb
+++ b/spec/support/shared_examples/models/cluster_application_helm_cert_shared_examples.rb
@@ -28,22 +28,46 @@ RSpec.shared_examples 'cluster application helm specs' do |application_name|
describe '#files' do
subject { application.files }
- context 'when the helm application does not have a ca_cert' do
+ context 'managed_apps_local_tiller feature flag is disabled' do
before do
- application.cluster.application_helm.ca_cert = nil
+ stub_feature_flags(managed_apps_local_tiller: false)
end
- it 'does not include cert files when there is no ca_cert entry' do
- expect(subject).not_to include(:'ca.pem', :'cert.pem', :'key.pem')
+ context 'when the helm application does not have a ca_cert' do
+ before do
+ application.cluster.application_helm.ca_cert = nil
+ end
+
+ it 'does not include cert files when there is no ca_cert entry' do
+ expect(subject).not_to include(:'ca.pem', :'cert.pem', :'key.pem')
+ end
+ end
+
+ it 'includes cert files when there is a ca_cert entry' do
+ expect(subject).to include(:'ca.pem', :'cert.pem', :'key.pem')
+ expect(subject[:'ca.pem']).to eq(application.cluster.application_helm.ca_cert)
+
+ cert = OpenSSL::X509::Certificate.new(subject[:'cert.pem'])
+ expect(cert.not_after).to be < 60.minutes.from_now
end
end
- it 'includes cert files when there is a ca_cert entry' do
- expect(subject).to include(:'ca.pem', :'cert.pem', :'key.pem')
- expect(subject[:'ca.pem']).to eq(application.cluster.application_helm.ca_cert)
+ context 'managed_apps_local_tiller feature flag is enabled' do
+ before do
+ stub_feature_flags(managed_apps_local_tiller: true)
+ end
+
+ it 'does not include cert files' do
+ expect(subject).not_to include(:'ca.pem', :'cert.pem', :'key.pem')
+ end
+
+ context 'when cluster does not have helm installed' do
+ let(:application) { create(application_name, :no_helm_installed) }
- cert = OpenSSL::X509::Certificate.new(subject[:'cert.pem'])
- expect(cert.not_after).to be < 60.minutes.from_now
+ it 'does not include cert files' do
+ expect(subject).not_to include(:'ca.pem', :'cert.pem', :'key.pem')
+ end
+ end
end
end
end
diff --git a/spec/support/shared_examples/models/cluster_application_status_shared_examples.rb b/spec/support/shared_examples/models/cluster_application_status_shared_examples.rb
index e4e49b94e42..6c772ddf897 100644
--- a/spec/support/shared_examples/models/cluster_application_status_shared_examples.rb
+++ b/spec/support/shared_examples/models/cluster_application_status_shared_examples.rb
@@ -48,14 +48,44 @@ RSpec.shared_examples 'cluster application status specs' do |application_name|
expect(subject).to be_installed
end
- it 'updates helm version' do
- subject.cluster.application_helm.update!(version: '1.2.3')
+ context 'managed_apps_local_tiller feature flag disabled' do
+ before do
+ stub_feature_flags(managed_apps_local_tiller: false)
+ end
- subject.make_installed!
+ it 'updates helm version' do
+ subject.cluster.application_helm.update!(version: '1.2.3')
- subject.cluster.application_helm.reload
+ subject.make_installed!
- expect(subject.cluster.application_helm.version).to eq(Gitlab::Kubernetes::Helm::HELM_VERSION)
+ subject.cluster.application_helm.reload
+
+ expect(subject.cluster.application_helm.version).to eq(Gitlab::Kubernetes::Helm::HELM_VERSION)
+ end
+ end
+
+ context 'managed_apps_local_tiller feature flag enabled' do
+ before do
+ stub_feature_flags(managed_apps_local_tiller: true)
+ end
+
+ it 'does not update the helm version' do
+ subject.cluster.application_helm.update!(version: '1.2.3')
+
+ expect do
+ subject.make_installed!
+
+ subject.cluster.application_helm.reload
+ end.not_to change { subject.cluster.application_helm.version }
+ end
+
+ context 'the cluster has no helm installed' do
+ subject { create(application_name, :installing, :no_helm_installed) }
+
+ it 'runs without errors' do
+ expect { subject.make_installed! }.not_to raise_error
+ end
+ end
end
it 'sets the correct version of the application' do
@@ -77,14 +107,44 @@ RSpec.shared_examples 'cluster application status specs' do |application_name|
expect(subject).to be_updated
end
- it 'updates helm version' do
- subject.cluster.application_helm.update!(version: '1.2.3')
+ context 'managed_apps_local_tiller feature flag disabled' do
+ before do
+ stub_feature_flags(managed_apps_local_tiller: false)
+ end
- subject.make_installed!
+ it 'updates helm version' do
+ subject.cluster.application_helm.update!(version: '1.2.3')
- subject.cluster.application_helm.reload
+ subject.make_installed!
- expect(subject.cluster.application_helm.version).to eq(Gitlab::Kubernetes::Helm::HELM_VERSION)
+ subject.cluster.application_helm.reload
+
+ expect(subject.cluster.application_helm.version).to eq(Gitlab::Kubernetes::Helm::HELM_VERSION)
+ end
+ end
+
+ context 'managed_apps_local_tiller feature flag enabled' do
+ before do
+ stub_feature_flags(managed_apps_local_tiller: true)
+ end
+
+ it 'does not update the helm version' do
+ subject.cluster.application_helm.update!(version: '1.2.3')
+
+ expect do
+ subject.make_installed!
+
+ subject.cluster.application_helm.reload
+ end.not_to change { subject.cluster.application_helm.version }
+ end
+
+ context 'the cluster has no helm installed' do
+ subject { create(application_name, :updating, :no_helm_installed) }
+
+ it 'runs without errors' do
+ expect { subject.make_installed! }.not_to raise_error
+ end
+ end
end
it 'updates the version of the application' do