Verify in CI that fast unit specs load without errors
What does this MR do and why?
This MR tweaks the rspec fast_spec_helper
job to not only load the spec helper spec/fast_spec_helper
but also all "fast specs" which uses fast_spec_helper
. No jobs are being run because of --dry-run
.
This MR is a follow-up of !78543 (merged) (also MR dependency).
Output
Before
If run without all the fixes from !78543 (merged):
$ bin/rspec --dry-run $(git grep -l -E '^require.*fast_spec_helper')
An error occurred while loading ./ee/spec/lib/elastic/latest/config_spec.rb.
Failure/Error: extend Elasticsearch::Model::Indexing::ClassMethods
NameError:
uninitialized constant Elastic::Latest::Config::Elasticsearch
# ./ee/lib/elastic/latest/config.rb:7:in `<module:Config>'
# ./ee/lib/elastic/latest/config.rb:5:in `<module:Latest>'
# ./ee/lib/elastic/latest/config.rb:4:in `<module:Elastic>'
# ./ee/lib/elastic/latest/config.rb:3:in `<top (required)>'
# ./ee/spec/lib/elastic/latest/config_spec.rb:6:in `<top (required)>'
An error occurred while loading ./ee/spec/lib/elastic/latest/issue_config_spec.rb.
Failure/Error: extend Elasticsearch::Model::Indexing::ClassMethods
NameError:
uninitialized constant Elastic::Latest::IssueConfig::Elasticsearch
# ./ee/lib/elastic/latest/issue_config.rb:7:in `<module:IssueConfig>'
# ./ee/lib/elastic/latest/issue_config.rb:5:in `<module:Latest>'
# ./ee/lib/elastic/latest/issue_config.rb:4:in `<module:Elastic>'
# ./ee/lib/elastic/latest/issue_config.rb:3:in `<top (required)>'
# ./ee/spec/lib/elastic/latest/issue_config_spec.rb:6:in `<top (required)>'
An error occurred while loading ./ee/spec/lib/elastic/latest/merge_request_config_spec.rb.
Failure/Error: extend Elasticsearch::Model::Indexing::ClassMethods
NameError:
uninitialized constant Elastic::Latest::MergeRequestConfig::Elasticsearch
# ./ee/lib/elastic/latest/merge_request_config.rb:7:in `<module:MergeRequestConfig>'
# ./ee/lib/elastic/latest/merge_request_config.rb:5:in `<module:Latest>'
# ./ee/lib/elastic/latest/merge_request_config.rb:4:in `<module:Elastic>'
# ./ee/lib/elastic/latest/merge_request_config.rb:3:in `<top (required)>'
# ./ee/spec/lib/elastic/latest/merge_request_config_spec.rb:6:in `<top (required)>'
An error occurred while loading ./ee/spec/lib/elastic/latest/note_config_spec.rb.
Failure/Error: extend Elasticsearch::Model::Indexing::ClassMethods
NameError:
uninitialized constant Elastic::Latest::NoteConfig::Elasticsearch
# ./ee/lib/elastic/latest/note_config.rb:7:in `<module:NoteConfig>'
# ./ee/lib/elastic/latest/note_config.rb:5:in `<module:Latest>'
# ./ee/lib/elastic/latest/note_config.rb:4:in `<module:Elastic>'
# ./ee/lib/elastic/latest/note_config.rb:3:in `<top (required)>'
# ./ee/spec/lib/elastic/latest/note_config_spec.rb:6:in `<top (required)>'
An error occurred while loading ./ee/spec/workers/concerns/elastic/migration_obsolete_spec.rb.
Failure/Error:
RSpec.describe Elastic::MigrationObsolete do
let(:migration_class) do
Class.new do
include Elastic::MigrationObsolete
end
end
subject { migration_class.new }
describe '#migrate' do
NameError:
uninitialized constant Elastic::MigrationObsolete
# ./ee/spec/workers/concerns/elastic/migration_obsolete_spec.rb:5:in `<top (required)>'
An error occurred while loading ./ee/spec/workers/concerns/elastic/migration_options_spec.rb.
Failure/Error:
RSpec.describe Elastic::MigrationOptions do
let(:migration_class) do
Class.new do
include Elastic::MigrationOptions
end
end
shared_examples_for 'a boolean option' do |option|
subject { migration_class.new.public_send("#{option}?") }
NameError:
uninitialized constant Elastic::MigrationOptions
# ./ee/spec/workers/concerns/elastic/migration_options_spec.rb:5:in `<top (required)>'
An error occurred while loading ./spec/lib/gitlab/ci/config/entry/policy_spec.rb.
Failure/Error: Feature.prepend(StubbedFeature)
NameError:
uninitialized constant StubFeatureFlags::StubbedFeature
Did you mean? StubFeatureFlags::StubFeatureGate
# ./spec/support/helpers/stub_feature_flags.rb:6:in `included'
# ./spec/lib/gitlab/ci/config/entry/policy_spec.rb:50:in `include'
# ./spec/lib/gitlab/ci/config/entry/policy_spec.rb:50:in `block (5 levels) in <main>'
# ./spec/lib/gitlab/ci/config/entry/policy_spec.rb:49:in `block (4 levels) in <main>'
# ./spec/lib/gitlab/ci/config/entry/policy_spec.rb:12:in `block (3 levels) in <main>'
# ./spec/lib/gitlab/ci/config/entry/policy_spec.rb:11:in `block (2 levels) in <main>'
# ./spec/lib/gitlab/ci/config/entry/policy_spec.rb:10:in `block in <main>'
# ./spec/lib/gitlab/ci/config/entry/policy_spec.rb:7:in `<main>'
An error occurred while loading ./spec/lib/gitlab/database/background_migration/batch_metrics_spec.rb.
Failure/Error: PRIMARY_DATABASE_NAME = ActiveRecord::Base.connection_db_config.name.to_sym
NameError:
uninitialized constant Gitlab::Database::ActiveRecord
# ./lib/gitlab/database.rb:52:in `<module:Database>'
# ./lib/gitlab/database.rb:4:in `<module:Gitlab>'
# ./lib/gitlab/database.rb:3:in `<main>'
# ./spec/lib/gitlab/database/background_migration/batch_metrics_spec.rb:5:in `<main>'
/home/peter/.dotfiles/asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/set-1.0.1/lib/set.rb:648: warning: already initialized constant Set::InspectKey
/home/peter/.dotfiles/asdf/installs/ruby/2.7.5/lib/ruby/2.7.0/set.rb:618: warning: previous definition of InspectKey was here
[TEST PROF INFO] FactoryDoctor enabled (event: "sql.active_record", threshold: 0.01)
[TEST PROF INFO] FactoryProf enabled (simple mode)
Detected fast_spec_helper is loaded first than spec_helper.
If running test files using both spec_helper and fast_spec_helper,
make sure test file with spec_helper is loaded first.
Aborting...
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
[TEST PROF INFO] No factories detected
After
After all the fixes from !78543 (merged).
$ bin/rspec --dry-run $(git grep -l -E '^require.*fast_spec_helper')
/home/peter/.dotfiles/asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/set-1.0.1/lib/set.rb:648: warning: already initialized constant Set::InspectKey
/home/peter/.dotfiles/asdf/installs/ruby/2.7.5/lib/ruby/2.7.0/set.rb:618: warning: previous definition of InspectKey was here
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/cli_methods.rb:18: warning: already initialized constant Gitlab::SidekiqConfig::CliMethods::QUEUE_CONFIG_PATHS
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/cli_methods.rb:18: warning: previous definition of QUEUE_CONFIG_PATHS was here
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:6: warning: already initialized constant Gitlab::SidekiqConfig::WorkerMatcher::WILDCARD_MATCH
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:6: warning: previous definition of WILDCARD_MATCH was here
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:7: warning: already initialized constant Gitlab::SidekiqConfig::WorkerMatcher::QUERY_OR_OPERATOR
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:7: warning: previous definition of QUERY_OR_OPERATOR was here
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:8: warning: already initialized constant Gitlab::SidekiqConfig::WorkerMatcher::QUERY_AND_OPERATOR
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:8: warning: previous definition of QUERY_AND_OPERATOR was here
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:9: warning: already initialized constant Gitlab::SidekiqConfig::WorkerMatcher::QUERY_CONCATENATE_OPERATOR
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:9: warning: previous definition of QUERY_CONCATENATE_OPERATOR was here
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:10: warning: already initialized constant Gitlab::SidekiqConfig::WorkerMatcher::QUERY_TERM_REGEX
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:10: warning: previous definition of QUERY_TERM_REGEX was here
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:12: warning: already initialized constant Gitlab::SidekiqConfig::WorkerMatcher::QUERY_PREDICATES
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:12: warning: previous definition of QUERY_PREDICATES was here
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:22: warning: already initialized constant Gitlab::SidekiqConfig::WorkerMatcher::QueryError
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:22: warning: previous definition of QueryError was here
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:23: warning: already initialized constant Gitlab::SidekiqConfig::WorkerMatcher::InvalidTerm
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:23: warning: previous definition of InvalidTerm was here
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:24: warning: already initialized constant Gitlab::SidekiqConfig::WorkerMatcher::UnknownOperator
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:24: warning: previous definition of UnknownOperator was here
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:25: warning: already initialized constant Gitlab::SidekiqConfig::WorkerMatcher::UnknownPredicate
/home/peter/devel/gitlab/gdk-ee/gitlab/lib/gitlab/sidekiq_config/worker_matcher.rb:25: warning: previous definition of UnknownPredicate was here
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Finished in 0.33244 seconds (files took 3.85 seconds to load)
2294 examples, 0 failures
How to set up and validate locally
Run
while :; do bin/rspec --dry-run $(git grep -l -E '^require.*fast_spec_helper' | sort -r) || break; done
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Peter Leitzen