summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-11-07 15:00:38 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-11-07 15:00:38 +0000
commit5dc0577b84b9d41b1e2a6e781dfeaa400e8e2c10 (patch)
tree06954c98466840c21b88de8c929a36086d1310a2 /spec/support
parentfadaa3d181b26c420a2424d35780cddc9fc32ce0 (diff)
parentc2097ed74cc832972142d24f3cda1faf7a96d550 (diff)
downloadgitlab-ce-5dc0577b84b9d41b1e2a6e781dfeaa400e8e2c10.tar.gz
Merge branch 'triggermesh-phase1-knative' into 'master'
Allow to install Knative as cluster application See merge request gitlab-org/gitlab-ce!22593
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/models/cluster_application_helm_cert_examples.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/support/shared_examples/models/cluster_application_helm_cert_examples.rb b/spec/support/shared_examples/models/cluster_application_helm_cert_examples.rb
new file mode 100644
index 00000000000..d87b3181e80
--- /dev/null
+++ b/spec/support/shared_examples/models/cluster_application_helm_cert_examples.rb
@@ -0,0 +1,25 @@
+shared_examples 'cluster application helm specs' do |application_name|
+ let(:application) { create(application_name) }
+
+ describe '#files' do
+ subject { application.files }
+
+ context 'when the helm application does not have a ca_cert' do
+ before do
+ application.cluster.application_helm.ca_cert = nil
+ end
+
+ it 'should 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 'should include 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
+end