diff options
Diffstat (limited to 'spec/services/deployments')
-rw-r--r-- | spec/services/deployments/link_merge_requests_service_spec.rb | 4 | ||||
-rw-r--r-- | spec/services/deployments/update_environment_service_spec.rb | 27 |
2 files changed, 27 insertions, 4 deletions
diff --git a/spec/services/deployments/link_merge_requests_service_spec.rb b/spec/services/deployments/link_merge_requests_service_spec.rb index 62adc834733..a653cd2b48b 100644 --- a/spec/services/deployments/link_merge_requests_service_spec.rb +++ b/spec/services/deployments/link_merge_requests_service_spec.rb @@ -159,10 +159,10 @@ RSpec.describe Deployments::LinkMergeRequestsService do it "doesn't link the same merge_request twice" do create(:merge_request, :merged, merge_commit_sha: mr1_merge_commit_sha, - source_project: project) + source_project: project) picked_mr = create(:merge_request, :merged, merge_commit_sha: '123abc', - source_project: project) + source_project: project) # the first MR includes c1c67abba which is a cherry-pick of the fake picked_mr merge request create(:track_mr_picking_note, noteable: picked_mr, project: project, commit_id: 'c1c67abbaf91f624347bb3ae96eabe3a1b742478') diff --git a/spec/services/deployments/update_environment_service_spec.rb b/spec/services/deployments/update_environment_service_spec.rb index 4485ce585bb..c952bcddd9a 100644 --- a/spec/services/deployments/update_environment_service_spec.rb +++ b/spec/services/deployments/update_environment_service_spec.rb @@ -159,14 +159,37 @@ RSpec.describe Deployments::UpdateEnvironmentService do { name: 'production', auto_stop_in: '1 day' } end + before do + environment.update_attribute(:auto_stop_at, nil) + end + it 'renews auto stop at' do freeze_time do - environment.update!(auto_stop_at: nil) - expect { subject.execute } .to change { environment.reset.auto_stop_at&.round }.from(nil).to(1.day.since.round) end end + + context 'when value is a variable' do + let(:options) { { name: 'production', auto_stop_in: '$TTL' } } + + let(:yaml_variables) do + [ + { key: "TTL", value: '2 days', public: true } + ] + end + + before do + job.update_attribute(:yaml_variables, yaml_variables) + end + + it 'renews auto stop at with expanded variable value' do + freeze_time do + expect { subject.execute } + .to change { environment.reset.auto_stop_at&.round }.from(nil).to(2.days.since.round) + end + end + end end context 'when deployment tier is specified' do |