Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-31 12:08:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-31 12:08:16 +0300
commit6044caed20964a70c1ac6c5a3365d567ed96dfde (patch)
tree3fe8f14b4acbd542265544843efeb6f59b5d3efe /spec/lib
parent92077e0f8d70c70a908395808b16f98ecd3a5fcd (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/ci/pipeline/chain/config/content_spec.rb79
-rw-r--r--spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb2
-rw-r--r--spec/lib/gitlab/database/batch_count_spec.rb8
3 files changed, 23 insertions, 66 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 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