diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-31 18:07:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-31 18:07:53 +0300 |
commit | d7a028e20d29b8c6d0e780ac168544dfbb712d3c (patch) | |
tree | f9fc9ea12e166aec6c4ffe476ba7a3566396b696 /spec/lib/gitlab/ci | |
parent | 0d0cddc9ce20c5a7d8a2723d0aa620ca184a711a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/ci')
-rw-r--r-- | spec/lib/gitlab/ci/pipeline/chain/config/content_spec.rb | 140 |
1 files changed, 0 insertions, 140 deletions
diff --git a/spec/lib/gitlab/ci/pipeline/chain/config/content_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/config/content_spec.rb index b5f0783cb42..fc95bb602c2 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/config/content_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/config/content_spec.rb @@ -10,146 +10,6 @@ describe Gitlab::Ci::Pipeline::Chain::Config::Content do subject { described_class.new(pipeline, command) } describe '#perform!' do - context 'when feature flag is disabled' do - before do - stub_feature_flags(ci_root_config_content: false) - end - - context 'when bridge job is passed in as parameter' do - let(:ci_config_path) { nil } - let(:bridge) { create(:ci_bridge) } - - before do - command.bridge = bridge - end - - context 'when bridge job has downstream yaml' do - before do - allow(bridge).to receive(:yaml_for_downstream).and_return('the-yaml') - end - - it 'returns the content already available in command' do - subject.perform! - - expect(pipeline.config_source).to eq 'bridge_source' - expect(command.config_content).to eq 'the-yaml' - end - end - - context 'when bridge job does not have downstream yaml' do - before do - allow(bridge).to receive(:yaml_for_downstream).and_return(nil) - end - - it 'returns the next available source' do - subject.perform! - - expect(pipeline.config_source).to eq 'auto_devops_source' - template = Gitlab::Template::GitlabCiYmlTemplate.find('Auto-DevOps') - expect(command.config_content).to eq(template.content) - end - end - end - - context 'when config is defined in a custom path in the repository' do - let(:ci_config_path) { 'path/to/config.yml' } - - before do - expect(project.repository) - .to receive(:gitlab_ci_yml_for) - .with(pipeline.sha, ci_config_path) - .and_return('the-content') - end - - it 'returns the content of the YAML file' do - subject.perform! - - expect(pipeline.config_source).to eq 'repository_source' - expect(pipeline.pipeline_config).to be_nil - expect(command.config_content).to eq('the-content') - end - end - - context 'when config is defined remotely' do - let(:ci_config_path) { 'http://example.com/path/to/ci/config.yml' } - - it 'does not support URLs and default to AutoDevops' do - subject.perform! - - expect(pipeline.config_source).to eq 'auto_devops_source' - expect(pipeline.pipeline_config).to be_nil - template = Gitlab::Template::GitlabCiYmlTemplate.find('Auto-DevOps') - expect(command.config_content).to eq(template.content) - end - end - - context 'when config is defined in a separate repository' do - let(:ci_config_path) { 'path/to/.gitlab-ci.yml@another-group/another-repo' } - - it 'does not support YAML from external repository and default to AutoDevops' do - subject.perform! - - expect(pipeline.config_source).to eq 'auto_devops_source' - expect(pipeline.pipeline_config).to be_nil - template = Gitlab::Template::GitlabCiYmlTemplate.find('Auto-DevOps') - expect(command.config_content).to eq(template.content) - end - end - - context 'when config is defined in the default .gitlab-ci.yml' do - let(:ci_config_path) { nil } - - before do - expect(project.repository) - .to receive(:gitlab_ci_yml_for) - .with(pipeline.sha, '.gitlab-ci.yml') - .and_return('the-content') - end - - it 'returns the content of the canonical config file' do - subject.perform! - - expect(pipeline.config_source).to eq 'repository_source' - expect(pipeline.pipeline_config).to be_nil - expect(command.config_content).to eq('the-content') - end - end - - context 'when config is the Auto-Devops template' do - let(:ci_config_path) { nil } - - before do - expect(project).to receive(:auto_devops_enabled?).and_return(true) - end - - it 'returns the content of AutoDevops template' do - subject.perform! - - expect(pipeline.config_source).to eq 'auto_devops_source' - expect(pipeline.pipeline_config).to be_nil - template = Gitlab::Template::GitlabCiYmlTemplate.find('Auto-DevOps') - expect(command.config_content).to eq(template.content) - end - end - - context 'when config is not defined anywhere' do - let(:ci_config_path) { nil } - - before do - expect(project).to receive(:auto_devops_enabled?).and_return(false) - end - - it 'builds root config including the auto-devops template' do - subject.perform! - - expect(pipeline.config_source).to eq('unknown_source') - expect(pipeline.pipeline_config).to be_nil - expect(command.config_content).to be_nil - expect(pipeline.errors.full_messages).to include('Missing CI config file') - end - end - end - context 'when bridge job is passed in as parameter' do let(:ci_config_path) { nil } let(:bridge) { create(:ci_bridge) } |