diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-12 12:13:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-12 12:13:02 +0300 |
commit | fc52f69f815eecbad9fcfe6b974f0c3e9c553828 (patch) | |
tree | 272c001c47ada803eb2844caa24a916b55f6f2d9 /spec/lib/gitlab | |
parent | 04cc67da3e796c95dd72a3b725cc48f1e44bea3a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/environment_spec.rb | 10 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/pipeline/seed/environment_spec.rb | 26 |
2 files changed, 30 insertions, 6 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/environment_spec.rb b/spec/lib/gitlab/ci/config/entry/environment_spec.rb index 36c26c8ee4f..3562706ff33 100644 --- a/spec/lib/gitlab/ci/config/entry/environment_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/environment_spec.rb @@ -230,12 +230,12 @@ RSpec.describe Gitlab::Ci::Config::Entry::Environment do end end - context 'when auto_stop_in is invalid format' do - let(:auto_stop_in) { 'invalid' } + context 'when variables are used for auto_stop_in' do + let(:auto_stop_in) { '$TTL' } - it 'becomes invalid' do - expect(entry).not_to be_valid - expect(entry.errors).to include 'environment auto stop in should be a duration' + it 'becomes valid' do + expect(entry).to be_valid + expect(entry.auto_stop_in).to eq(auto_stop_in) end end end diff --git a/spec/lib/gitlab/ci/pipeline/seed/environment_spec.rb b/spec/lib/gitlab/ci/pipeline/seed/environment_spec.rb index ad89f1f5cda..ade0951f81a 100644 --- a/spec/lib/gitlab/ci/pipeline/seed/environment_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/seed/environment_spec.rb @@ -5,7 +5,9 @@ require 'spec_helper' RSpec.describe Gitlab::Ci::Pipeline::Seed::Environment do let_it_be(:project) { create(:project) } - let(:job) { build(:ci_build, project: project) } + let!(:pipeline) { create(:ci_pipeline, project: project) } + + let(:job) { build(:ci_build, project: project, pipeline: pipeline) } let(:seed) { described_class.new(job) } let(:attributes) { {} } @@ -87,6 +89,28 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Environment do it_behaves_like 'returning a correct environment' end + + context 'and job environment has an auto_stop_in variable attribute' do + let(:environment_auto_stop_in) { '10 minutes' } + let(:expected_auto_stop_in) { '10 minutes' } + + let(:attributes) do + { + environment: environment_name, + options: { + environment: { + name: environment_name, + auto_stop_in: '$TTL' + } + }, + yaml_variables: [ + { key: "TTL", value: environment_auto_stop_in, public: true } + ] + } + end + + it_behaves_like 'returning a correct environment' + end end context 'when job has deployment tier attribute' do |