summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/models/cluster_application_status_shared_examples.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared_examples/models/cluster_application_status_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/models/cluster_application_status_shared_examples.rb53
1 files changed, 53 insertions, 0 deletions
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 554f2e747bc..0b19b50fdfc 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,6 +48,36 @@ shared_examples 'cluster application status specs' do |application_name|
expect(subject.version).to eq(subject.class.const_get(:VERSION))
end
+
+ context 'application is updating' do
+ subject { create(application_name, :updating) }
+
+ it 'is updated' do
+ subject.make_installed!
+
+ expect(subject).to be_updated
+ end
+
+ it 'updates helm version' do
+ subject.cluster.application_helm.update!(version: '1.2.3')
+
+ subject.make_installed!
+
+ subject.cluster.application_helm.reload
+
+ expect(subject.cluster.application_helm.version).to eq(Gitlab::Kubernetes::Helm::HELM_VERSION)
+ end
+
+ it 'updates the version of the application' do
+ subject.update!(version: '0.0.0')
+
+ subject.make_installed!
+
+ subject.reload
+
+ expect(subject.version).to eq(subject.class.const_get(:VERSION))
+ end
+ end
end
describe '#make_updated' do
@@ -90,6 +120,17 @@ shared_examples 'cluster application status specs' do |application_name|
expect(subject).to be_errored
expect(subject.status_reason).to eq(reason)
end
+
+ context 'application is updating' do
+ subject { create(application_name, :updating) }
+
+ it 'is update_errored' do
+ subject.make_errored(reason)
+
+ expect(subject).to be_update_errored
+ expect(subject.status_reason).to eq(reason)
+ end
+ end
end
describe '#make_scheduled' do
@@ -112,6 +153,18 @@ shared_examples 'cluster application status specs' do |application_name|
expect(subject.status_reason).to be_nil
end
end
+
+ describe 'when was updated_errored' do
+ subject { create(application_name, :update_errored) }
+
+ it 'clears #status_reason' do
+ expect(subject.status_reason).not_to be_nil
+
+ subject.make_scheduled!
+
+ expect(subject.status_reason).to be_nil
+ end
+ end
end
end