diff options
Diffstat (limited to 'spec/lib/gitlab/ci/yaml_processor_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/yaml_processor_spec.rb | 149 |
1 files changed, 0 insertions, 149 deletions
diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb index ad94dfc9160..94ab4819361 100644 --- a/spec/lib/gitlab/ci/yaml_processor_spec.rb +++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb @@ -1419,155 +1419,6 @@ module Gitlab end end - context 'with multiple_cache_per_job FF disabled' do - before do - stub_feature_flags(multiple_cache_per_job: false) - end - describe 'cache' do - context 'when cache definition has unknown keys' do - let(:config) do - YAML.dump( - { cache: { untracked: true, invalid: 'key' }, - rspec: { script: 'rspec' } }) - end - - it_behaves_like 'returns errors', 'cache config contains unknown keys: invalid' - end - - it "returns cache when defined globally" do - config = YAML.dump({ - cache: { paths: ["logs/", "binaries/"], untracked: true, key: 'key' }, - rspec: { - script: "rspec" - } - }) - - config_processor = Gitlab::Ci::YamlProcessor.new(config).execute - - expect(config_processor.stage_builds_attributes("test").size).to eq(1) - expect(config_processor.stage_builds_attributes("test").first[:cache]).to eq( - paths: ["logs/", "binaries/"], - untracked: true, - key: 'key', - policy: 'pull-push', - when: 'on_success' - ) - end - - it "returns cache when defined in default context" do - config = YAML.dump( - { - default: { - cache: { paths: ["logs/", "binaries/"], untracked: true, key: { files: ['file'] } } - }, - rspec: { - script: "rspec" - } - }) - - config_processor = Gitlab::Ci::YamlProcessor.new(config).execute - - expect(config_processor.stage_builds_attributes("test").size).to eq(1) - expect(config_processor.stage_builds_attributes("test").first[:cache]).to eq( - paths: ["logs/", "binaries/"], - untracked: true, - key: { files: ['file'] }, - policy: 'pull-push', - when: 'on_success' - ) - end - - it 'returns cache key when defined in a job' do - config = YAML.dump({ - rspec: { - cache: { paths: ['logs/', 'binaries/'], untracked: true, key: 'key' }, - script: 'rspec' - } - }) - - config_processor = Gitlab::Ci::YamlProcessor.new(config).execute - - expect(config_processor.stage_builds_attributes('test').size).to eq(1) - expect(config_processor.stage_builds_attributes('test').first[:cache]).to eq( - paths: ['logs/', 'binaries/'], - untracked: true, - key: 'key', - policy: 'pull-push', - when: 'on_success' - ) - end - - it 'returns cache files' do - config = YAML.dump( - rspec: { - cache: { - paths: ['logs/', 'binaries/'], - untracked: true, - key: { files: ['file'] } - }, - script: 'rspec' - } - ) - - config_processor = Gitlab::Ci::YamlProcessor.new(config).execute - - expect(config_processor.stage_builds_attributes('test').size).to eq(1) - expect(config_processor.stage_builds_attributes('test').first[:cache]).to eq( - paths: ['logs/', 'binaries/'], - untracked: true, - key: { files: ['file'] }, - policy: 'pull-push', - when: 'on_success' - ) - end - - it 'returns cache files with prefix' do - config = YAML.dump( - rspec: { - cache: { - paths: ['logs/', 'binaries/'], - untracked: true, - key: { files: ['file'], prefix: 'prefix' } - }, - script: 'rspec' - } - ) - - config_processor = Gitlab::Ci::YamlProcessor.new(config).execute - - expect(config_processor.stage_builds_attributes('test').size).to eq(1) - expect(config_processor.stage_builds_attributes('test').first[:cache]).to eq( - paths: ['logs/', 'binaries/'], - untracked: true, - key: { files: ['file'], prefix: 'prefix' }, - policy: 'pull-push', - when: 'on_success' - ) - end - - it "overwrite cache when defined for a job and globally" do - config = YAML.dump({ - cache: { paths: ["logs/", "binaries/"], untracked: true, key: 'global' }, - rspec: { - script: "rspec", - cache: { paths: ["test/"], untracked: false, key: 'local' } - } - }) - - config_processor = Gitlab::Ci::YamlProcessor.new(config).execute - - expect(config_processor.stage_builds_attributes("test").size).to eq(1) - expect(config_processor.stage_builds_attributes("test").first[:cache]).to eq( - paths: ["test/"], - untracked: false, - key: 'local', - policy: 'pull-push', - when: 'on_success' - ) - end - end - end - describe 'cache' do context 'when cache definition has unknown keys' do let(:config) do |