From 6044caed20964a70c1ac6c5a3365d567ed96dfde Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 31 Mar 2020 09:08:16 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../ci/pipeline/chain/config/content_spec.rb | 79 ++++------------------ .../templates/auto_devops_gitlab_ci_yaml_spec.rb | 2 - spec/lib/gitlab/database/batch_count_spec.rb | 8 +++ 3 files changed, 23 insertions(+), 66 deletions(-) (limited to 'spec/lib/gitlab') 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 4c4359ad5d2..b5f0783cb42 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/config/content_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/config/content_spec.rb @@ -45,7 +45,7 @@ describe Gitlab::Ci::Pipeline::Chain::Config::Content do subject.perform! expect(pipeline.config_source).to eq 'auto_devops_source' - template = Gitlab::Template::GitlabCiYmlTemplate.find('Beta/Auto-DevOps') + template = Gitlab::Template::GitlabCiYmlTemplate.find('Auto-DevOps') expect(command.config_content).to eq(template.content) end end @@ -78,7 +78,7 @@ describe Gitlab::Ci::Pipeline::Chain::Config::Content do expect(pipeline.config_source).to eq 'auto_devops_source' expect(pipeline.pipeline_config).to be_nil - template = Gitlab::Template::GitlabCiYmlTemplate.find('Beta/Auto-DevOps') + template = Gitlab::Template::GitlabCiYmlTemplate.find('Auto-DevOps') expect(command.config_content).to eq(template.content) end end @@ -91,7 +91,7 @@ describe Gitlab::Ci::Pipeline::Chain::Config::Content do expect(pipeline.config_source).to eq 'auto_devops_source' expect(pipeline.pipeline_config).to be_nil - template = Gitlab::Template::GitlabCiYmlTemplate.find('Beta/Auto-DevOps') + template = Gitlab::Template::GitlabCiYmlTemplate.find('Auto-DevOps') expect(command.config_content).to eq(template.content) end end @@ -122,34 +122,13 @@ describe Gitlab::Ci::Pipeline::Chain::Config::Content do expect(project).to receive(:auto_devops_enabled?).and_return(true) end - context 'when beta is enabled' do - before do - stub_feature_flags(auto_devops_beta: 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('Beta/Auto-DevOps') - expect(command.config_content).to eq(template.content) - end - end - - context 'when beta is disabled' do - before do - stub_feature_flags(auto_devops_beta: false) - end - - it 'returns the content of AutoDevops template' do - subject.perform! + 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 + 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 @@ -285,7 +264,7 @@ describe Gitlab::Ci::Pipeline::Chain::Config::Content do <<~EOY --- include: - - template: Beta/Auto-DevOps.gitlab-ci.yml + - template: Auto-DevOps.gitlab-ci.yml EOY end @@ -293,40 +272,12 @@ describe Gitlab::Ci::Pipeline::Chain::Config::Content do expect(project).to receive(:auto_devops_enabled?).and_return(true) end - context 'when beta is enabled' do - before do - stub_feature_flags(auto_devops_beta: true) - end - - it 'builds root config including the auto-devops template' do - subject.perform! - - expect(pipeline.config_source).to eq 'auto_devops_source' - expect(pipeline.pipeline_config.content).to eq(config_content_result) - expect(command.config_content).to eq(config_content_result) - end - end - - context 'when beta is disabled' do - before do - stub_feature_flags(auto_devops_beta: false) - end - - let(:config_content_result) do - <<~EOY - --- - include: - - template: Auto-DevOps.gitlab-ci.yml - EOY - end - - it 'builds root config including the auto-devops template' do - subject.perform! + it 'builds root config including the auto-devops template' do + subject.perform! - expect(pipeline.config_source).to eq 'auto_devops_source' - expect(pipeline.pipeline_config.content).to eq(config_content_result) - expect(command.config_content).to eq(config_content_result) - end + expect(pipeline.config_source).to eq 'auto_devops_source' + expect(pipeline.pipeline_config.content).to eq(config_content_result) + expect(command.config_content).to eq(config_content_result) end end diff --git a/spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb b/spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb index 12600d97b2f..0c5d172f17c 100644 --- a/spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb +++ b/spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb @@ -133,8 +133,6 @@ describe 'Auto-DevOps.gitlab-ci.yml' do end with_them do - subject(:template) { Gitlab::Template::GitlabCiYmlTemplate.find('Beta/Auto-DevOps') } - let(:user) { create(:admin) } let(:project) { create(:project, :custom_repo, files: files) } let(:service) { Ci::CreatePipelineService.new(project, user, ref: 'master' ) } diff --git a/spec/lib/gitlab/database/batch_count_spec.rb b/spec/lib/gitlab/database/batch_count_spec.rb index 0731791d9b0..b126d8579fc 100644 --- a/spec/lib/gitlab/database/batch_count_spec.rb +++ b/spec/lib/gitlab/database/batch_count_spec.rb @@ -90,5 +90,13 @@ describe Gitlab::Database::BatchCount do [1, 2, 4, 5, 6].each { |i| expect(described_class.batch_distinct_count(model, column, batch_size: i)).to eq(2) } end + + it 'counts with a start and finish' do + expect(described_class.batch_distinct_count(model, column, start: model.minimum(column), finish: model.maximum(column))).to eq(2) + end + + it 'counts with User min and max as start and finish' do + expect(described_class.batch_distinct_count(model, column, start: User.minimum(:id), finish: User.maximum(:id))).to eq(2) + end end end -- cgit v1.2.3