diff options
Diffstat (limited to 'spec/lib/gitlab/ci/config/entry')
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/environment_spec.rb | 26 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/job_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/reports_spec.rb | 14 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/root_spec.rb | 37 |
4 files changed, 12 insertions, 67 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/environment_spec.rb b/spec/lib/gitlab/ci/config/entry/environment_spec.rb index dd8a79f0d84..36c26c8ee4f 100644 --- a/spec/lib/gitlab/ci/config/entry/environment_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/environment_spec.rb @@ -92,24 +92,18 @@ RSpec.describe Gitlab::Ci::Config::Entry::Environment do end context 'when valid action is used' do - let(:config) do - { name: 'production', - action: 'start' } - end - - it 'is valid' do - expect(entry).to be_valid + where(:action) do + %w(start stop prepare verify access) end - end - context 'when prepare action is used' do - let(:config) do - { name: 'production', - action: 'prepare' } - end + with_them do + let(:config) do + { name: 'production', action: action } + end - it 'is valid' do - expect(entry).to be_valid + it 'is valid' do + expect(entry).to be_valid + end end end @@ -148,7 +142,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Environment do describe '#errors' do it 'contains error about invalid action' do expect(entry.errors) - .to include 'environment action should be start, stop or prepare' + .to include 'environment action should be start, stop, prepare, verify, or access' end end end diff --git a/spec/lib/gitlab/ci/config/entry/job_spec.rb b/spec/lib/gitlab/ci/config/entry/job_spec.rb index 97691504abd..ca336c3ecaa 100644 --- a/spec/lib/gitlab/ci/config/entry/job_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/job_spec.rb @@ -27,7 +27,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Job do subject { described_class.nodes.keys } let(:result) do - %i[before_script script stage type after_script cache + %i[before_script script stage after_script cache image services only except rules needs variables artifacts environment coverage retry interruptible timeout release tags inherit parallel] diff --git a/spec/lib/gitlab/ci/config/entry/reports_spec.rb b/spec/lib/gitlab/ci/config/entry/reports_spec.rb index 061d8f34c8d..051cccb4833 100644 --- a/spec/lib/gitlab/ci/config/entry/reports_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/reports_spec.rb @@ -45,10 +45,8 @@ RSpec.describe Gitlab::Ci::Config::Entry::Reports do :load_performance | 'load-performance.json' :lsif | 'lsif.json' :dotenv | 'build.dotenv' - :cobertura | 'cobertura-coverage.xml' :terraform | 'tfplan.json' :accessibility | 'gl-accessibility.json' - :cluster_applications | 'gl-cluster-applications.json' end with_them do @@ -90,18 +88,6 @@ RSpec.describe Gitlab::Ci::Config::Entry::Reports do expect(entry.value).to eq({ coverage_report: coverage_report, dast: ['gl-dast-report.json'] }) end end - - context 'and a direct coverage report format is specified' do - let(:config) { { coverage_report: coverage_report, cobertura: 'cobertura-coverage.xml' } } - - it 'is not valid' do - expect(entry).not_to be_valid - end - - it 'reports error' do - expect(entry.errors).to include /please use only one the following keys: coverage_report, cobertura/ - end - end end end diff --git a/spec/lib/gitlab/ci/config/entry/root_spec.rb b/spec/lib/gitlab/ci/config/entry/root_spec.rb index b9c32bc51be..55ad119ea21 100644 --- a/spec/lib/gitlab/ci/config/entry/root_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/root_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do # The purpose of `Root` is have only globally defined configuration. expect(described_class.nodes.keys) .to match_array(%i[before_script image services after_script - variables cache stages types include default workflow]) + variables cache stages include default workflow]) end end end @@ -55,41 +55,6 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do } end - context 'when deprecated types/type keywords are defined' do - let(:project) { create(:project, :repository) } - let(:user) { create(:user) } - - let(:hash) do - { types: %w(test deploy), - rspec: { script: 'rspec', type: 'test' } } - end - - before do - root.compose! - end - - it 'returns array of types as stages with a warning' do - expect(root.jobs_value[:rspec][:stage]).to eq 'test' - expect(root.stages_value).to eq %w[test deploy] - expect(root.warnings).to match_array([ - "root `types` is deprecated in 9.0 and will be removed in 15.0.", - "jobs:rspec `type` is deprecated in 9.0 and will be removed in 15.0." - ]) - end - - it 'logs usage of keywords' do - expect(Gitlab::AppJsonLogger).to( - receive(:info) - .with(event: 'ci_used_deprecated_keyword', - entry: root[:stages].key.to_s, - user_id: user.id, - project_id: project.id) - ) - - root.compose! - end - end - describe '#compose!' do before do root.compose! |