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
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/dot_gitlab_ci/rules_spec.rb35
-rw-r--r--spec/scripts/setup/generate_as_if_foss_env_spec.rb14
-rw-r--r--spec/simplecov_env.rb6
3 files changed, 51 insertions, 4 deletions
diff --git a/spec/dot_gitlab_ci/rules_spec.rb b/spec/dot_gitlab_ci/rules_spec.rb
index 8e13be25f4c..64047074051 100644
--- a/spec/dot_gitlab_ci/rules_spec.rb
+++ b/spec/dot_gitlab_ci/rules_spec.rb
@@ -29,4 +29,39 @@ RSpec.describe '.gitlab/ci/rules.gitlab-ci.yml', feature_category: :tooling do
end
end
end
+
+ describe 'start-as-if-foss' do
+ let(:base_rules) { config.dig('.as-if-foss:rules:start-as-if-foss', 'rules') }
+
+ context 'with .as-if-foss:rules:start-as-if-foss:allow-failure:manual' do
+ let(:derived_rules) { config.dig('.as-if-foss:rules:start-as-if-foss:allow-failure:manual', 'rules') }
+
+ it 'has the same rules as the base and also allow-failure and manual' do
+ base_rules.zip(derived_rules).each do |(base, derived)|
+ # !references should be the same. Stop rules should be the same.
+ if base.is_a?(Array) || base['when'] == 'never'
+ expect(base).to eq(derived)
+ else
+ expect(derived).to eq(
+ base.merge('allow_failure' => true, 'when' => 'manual'))
+ end
+ end
+ end
+ end
+
+ context 'with .as-if-foss:rules:start-as-if-foss:allow-failure' do
+ let(:derived_rules) { config.dig('.as-if-foss:rules:start-as-if-foss:allow-failure', 'rules') }
+
+ it 'has the same rules as the base and also allow-failure' do
+ base_rules.zip(derived_rules).each do |(base, derived)|
+ # !references should be the same. Stop rules should be the same.
+ if base.is_a?(Array) || base['when'] == 'never'
+ expect(base).to eq(derived)
+ else
+ expect(derived).to eq(base.merge('allow_failure' => true))
+ end
+ end
+ end
+ end
+ end
end
diff --git a/spec/scripts/setup/generate_as_if_foss_env_spec.rb b/spec/scripts/setup/generate_as_if_foss_env_spec.rb
index e437ce24e79..2b94ce5bb0c 100644
--- a/spec/scripts/setup/generate_as_if_foss_env_spec.rb
+++ b/spec/scripts/setup/generate_as_if_foss_env_spec.rb
@@ -21,7 +21,11 @@ RSpec.describe GenerateAsIfFossEnv, feature_category: :tooling do
let(:jobs) do
[
'rspec fast_spec_helper',
- 'rspec unit pg14',
+ 'rspec unit pg14 praefect 1/5',
+ 'rspec unit pg14 single-db 2/5',
+ 'rspec unit pg14 single-db-ci-connection 3/5',
+ 'rspec unit pg14 single-redis 4/5',
+ 'rspec unit pg14 5/5',
'rspec integration pg14',
'rspec system pg14',
'rspec migration pg14',
@@ -64,6 +68,10 @@ RSpec.describe GenerateAsIfFossEnv, feature_category: :tooling do
ENABLE_RSPEC: 'true',
ENABLE_RSPEC_FAST_SPEC_HELPER: 'true',
ENABLE_RSPEC_UNIT: 'true',
+ ENABLE_RSPEC_PRAEFECT: 'true',
+ ENABLE_RSPEC_SINGLE_DB: 'true',
+ ENABLE_RSPEC_SINGLE_DB_CI_CONNECTION: 'true',
+ ENABLE_RSPEC_SINGLE_REDIS: 'true',
ENABLE_RSPEC_INTEGRATION: 'true',
ENABLE_RSPEC_SYSTEM: 'true',
ENABLE_RSPEC_MIGRATION: 'true',
@@ -96,6 +104,10 @@ RSpec.describe GenerateAsIfFossEnv, feature_category: :tooling do
ENABLE_RSPEC=true
ENABLE_RSPEC_FAST_SPEC_HELPER=true
ENABLE_RSPEC_UNIT=true
+ ENABLE_RSPEC_PRAEFECT=true
+ ENABLE_RSPEC_SINGLE_DB=true
+ ENABLE_RSPEC_SINGLE_DB_CI_CONNECTION=true
+ ENABLE_RSPEC_SINGLE_REDIS=true
ENABLE_RSPEC_INTEGRATION=true
ENABLE_RSPEC_SYSTEM=true
ENABLE_RSPEC_MIGRATION=true
diff --git a/spec/simplecov_env.rb b/spec/simplecov_env.rb
index d48acc77afb..fbf4401ac2f 100644
--- a/spec/simplecov_env.rb
+++ b/spec/simplecov_env.rb
@@ -21,9 +21,9 @@ module SimpleCovEnv
def configure_job
SimpleCov.configure do
if ENV['CI_JOB_NAME']
- job_name = Gitlab::Utils.slugify(ENV['CI_JOB_NAME'])
- coverage_dir "coverage/#{job_name}"
- command_name job_name
+ coverage_name = Gitlab::Utils.slugify("#{ENV['CI_JOB_NAME']}-#{ENV['CI_PROJECT_ID']}")
+ coverage_dir "coverage/#{coverage_name}"
+ command_name coverage_name
end
if ENV['CI']