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
diff options
context:
space:
mode:
Diffstat (limited to 'spec/tooling/quality/test_level_spec.rb')
-rw-r--r--spec/tooling/quality/test_level_spec.rb43
1 files changed, 34 insertions, 9 deletions
diff --git a/spec/tooling/quality/test_level_spec.rb b/spec/tooling/quality/test_level_spec.rb
index 98034eb4b0a..10afcb18a73 100644
--- a/spec/tooling/quality/test_level_spec.rb
+++ b/spec/tooling/quality/test_level_spec.rb
@@ -1,8 +1,33 @@
# frozen_string_literal: true
+require 'spec_helper'
+
require_relative '../../../tooling/quality/test_level'
RSpec.describe Quality::TestLevel do
+ describe 'TEST_LEVEL_FOLDERS constant' do
+ it 'all directories it refers to exists', :aggregate_failures do
+ ee_only_directories = %w[
+ lib/ee/gitlab/background_migration
+ elastic
+ elastic_integration
+ replicators
+ ]
+
+ described_class::TEST_LEVEL_FOLDERS.values.flatten.each do |dir|
+ next if ee_only_directories.include?(dir) && !Gitlab.ee?
+
+ spec_directory = if ee_only_directories.include?(dir)
+ File.join('ee', 'spec', dir)
+ else
+ File.join('spec', dir)
+ end
+
+ expect(File.exist?(spec_directory)).to eq(true), "#{spec_directory} does not exist!"
+ end
+ end
+ end
+
describe '#pattern' do
context 'when level is all' do
it 'returns a pattern' do
@@ -21,7 +46,7 @@ RSpec.describe Quality::TestLevel do
context 'when level is unit' do
it 'returns a pattern' do
expect(subject.pattern(:unit))
- .to eq("spec/{bin,channels,config,db,dependencies,elastic,elastic_integration,experiments,events,factories,finders,frontend,graphql,haml_lint,helpers,initializers,javascripts,lib,metrics_server,models,policies,presenters,rack_servers,replicators,routing,rubocop,scripts,serializers,services,sidekiq,sidekiq_cluster,spam,support_specs,tasks,uploaders,validators,views,workers,tooling,component}{,/**/}*_spec.rb")
+ .to eq("spec/{bin,channels,config,db,dependencies,elastic,elastic_integration,experiments,events,factories,finders,frontend,graphql,haml_lint,helpers,initializers,lib,metrics_server,models,policies,presenters,rack_servers,replicators,routing,rubocop,scripts,serializers,services,sidekiq,sidekiq_cluster,spam,support_specs,tasks,uploaders,validators,views,workers,tooling,components}{,/**/}*_spec.rb")
end
end
@@ -89,56 +114,56 @@ RSpec.describe Quality::TestLevel do
context 'when level is frontend_fixture' do
it 'returns a regexp' do
expect(subject.regexp(:frontend_fixture))
- .to eq(%r{spec/(frontend/fixtures)})
+ .to eq(%r{spec/(frontend/fixtures)/})
end
end
context 'when level is unit' do
it 'returns a regexp' do
expect(subject.regexp(:unit))
- .to eq(%r{spec/(bin|channels|config|db|dependencies|elastic|elastic_integration|experiments|events|factories|finders|frontend|graphql|haml_lint|helpers|initializers|javascripts|lib|metrics_server|models|policies|presenters|rack_servers|replicators|routing|rubocop|scripts|serializers|services|sidekiq|sidekiq_cluster|spam|support_specs|tasks|uploaders|validators|views|workers|tooling|component)})
+ .to eq(%r{spec/(bin|channels|config|db|dependencies|elastic|elastic_integration|experiments|events|factories|finders|frontend|graphql|haml_lint|helpers|initializers|lib|metrics_server|models|policies|presenters|rack_servers|replicators|routing|rubocop|scripts|serializers|services|sidekiq|sidekiq_cluster|spam|support_specs|tasks|uploaders|validators|views|workers|tooling|components)/})
end
end
context 'when level is migration' do
it 'returns a regexp' do
expect(subject.regexp(:migration))
- .to eq(%r{spec/(migrations|lib/gitlab/background_migration|lib/ee/gitlab/background_migration)})
+ .to eq(%r{spec/(migrations|lib/gitlab/background_migration|lib/ee/gitlab/background_migration)/})
end
end
context 'when level is background_migration' do
it 'returns a regexp' do
expect(subject.regexp(:background_migration))
- .to eq(%r{spec/(lib/gitlab/background_migration|lib/ee/gitlab/background_migration)})
+ .to eq(%r{spec/(lib/gitlab/background_migration|lib/ee/gitlab/background_migration)/})
end
end
context 'when level is integration' do
it 'returns a regexp' do
expect(subject.regexp(:integration))
- .to eq(%r{spec/(commands|controllers|mailers|requests)})
+ .to eq(%r{spec/(commands|controllers|mailers|requests)/})
end
end
context 'when level is system' do
it 'returns a regexp' do
expect(subject.regexp(:system))
- .to eq(%r{spec/(features)})
+ .to eq(%r{spec/(features)/})
end
end
context 'with a prefix' do
it 'returns a regexp' do
expect(described_class.new('ee/').regexp(:system))
- .to eq(%r{(ee/)spec/(features)})
+ .to eq(%r{(ee/)spec/(features)/})
end
end
context 'with several prefixes' do
it 'returns a regexp' do
expect(described_class.new(['', 'ee/', 'jh/']).regexp(:system))
- .to eq(%r{(|ee/|jh/)spec/(features)})
+ .to eq(%r{(|ee/|jh/)spec/(features)/})
end
end