Skip to content

RSpec test order: Run spec/rubocop in random order

Peter Leitzen requested to merge pl-rspec-order-rubocop into master

What does this MR do and why?

This MR allows specs in spec/rubocop to be run in random order.

Contributes to #407877

Checked via:

scripts/rspec_check_order_dependence spec/rubocop

See !93137 (merged) and https://docs.gitlab.com/ee/development/testing_guide/best_practices.html#test-order for more details.

Screenshots or screen recordings

scripts/rspec_check_order_dependence spec/rubocop
Screenshot_from_2022-07-23_15-33-42

See pipeline #620445018 which already ran the RuboCop specs in random order.

For example, job https://gitlab.com/gitlab-org/gitlab/-/jobs/2920975963#L8884.

Click to expand
RuboCop::CodeReuseHelpers (order random)
RuboCop::Cop::ActiveModelErrorsDirectManipulation (order random)
RuboCop::Cop::ActiveRecordAssociationReload (order random)
RuboCop::Cop::API::Base (order random)
RuboCop::Cop::API::GrapeArrayMissingCoerce (order random)
RuboCop::Cop::AvoidBecomes (order random)
RuboCop::Cop::AvoidBreakFromStrongMemoize (order random)
RuboCop::Cop::AvoidKeywordArgumentsInSidekiqWorkers (order random)
RuboCop::Cop::AvoidReturnFromBlocks (order random)
RuboCop::Cop::AvoidRouteRedirectLeadingSlash (order random)
RuboCop::Cop::BanCatchThrow (order random)
RuboCop::Cop::CodeReuse::Finder (order random)
RuboCop::Cop::CodeReuse::Presenter (order random)
RuboCop::Cop::CodeReuse::Serializer (order random)
RuboCop::Cop::CodeReuse::ServiceClass (order random)
RuboCop::Cop::CodeReuse::Worker (order random)
RuboCop::Cop::Database::DisableReferentialIntegrity (order random)
RuboCop::Cop::Database::EstablishConnection (order random)
RuboCop::Cop::Database::MultipleDatabases (order random)
RuboCop::Cop::Database::RescueQueryCanceled (order random)
RuboCop::Cop::Database::RescueStatementTimeout (order random)
RuboCop::Cop::DefaultScope (order random)
RuboCop::Cop::DestroyAll (order random)
RuboCop::Cop::FileDecompression (order random)
RuboCop::Cop::FilenameLength (order random)
RuboCop::Cop::Gemspec::AvoidExecutingGit (order random)
RuboCop::Cop::Gitlab::AvoidFeatureCategoryNotOwned (order random)
RuboCop::Cop::Gitlab::AvoidUploadedFileFromParams (order random)
RuboCop::Cop::Gitlab::BulkInsert (order random)
RuboCop::Cop::Gitlab::ChangeTimezone (order random)
RuboCop::Cop::Gitlab::ConstGetInheritFalse (order random)
RuboCop::Cop::Gitlab::DelegatePredicateMethods (order random)
RuboCop::Cop::Gitlab::DeprecateTrackRedisHLLEvent (order random)
RuboCop::Cop::Gitlab::DuplicateSpecLocation (order random)
RuboCop::Cop::Gitlab::EventStoreSubscriber (order random)
RuboCop::Cop::Gitlab::Except (order random)
RuboCop::Cop::Gitlab::FeatureAvailableUsage (order random)
RuboCop::Cop::Gitlab::FinderWithFindBy (order random)
RuboCop::Cop::Gitlab::HTTParty (order random)
RuboCop::Cop::Gitlab::Intersect (order random)
RuboCop::Cop::Gitlab::Json (order random)
RuboCop::Cop::Gitlab::MarkUsedFeatureFlags (order random)
RuboCop::Cop::Gitlab::ModuleWithInstanceVariables (order random)
RuboCop::Cop::Gitlab::NamespacedClass (order random)
RuboCop::Cop::Gitlab::PolicyRuleBoolean (order random)
RuboCop::Cop::Gitlab::PredicateMemoization (order random)
RuboCop::Cop::Gitlab::RailsLogger (order random)
RuboCop::Cop::Gitlab::Union (order random)
RuboCop::Cop::Graphql::AuthorizeTypes (order random)
RuboCop::Cop::Graphql::Descriptions (order random)
RuboCop::Cop::Graphql::GIDExpectedType (order random)
RuboCop::Cop::Graphql::GraphqlNamePosition (order random)
RuboCop::Cop::Graphql::IDType (order random)
RuboCop::Cop::Graphql::JSONType (order random)
RuboCop::Cop::Graphql::OldTypes (order random)
RuboCop::Cop::Graphql::ResolverType (order random)
RuboCop::Cop::GroupPublicOrVisibleToUser (order random)
RuboCop::Cop::IgnoredColumns (order random)
RuboCop::Cop::IncludeSidekiqWorker (order random)
RuboCop::Cop::InjectEnterpriseEditionModule (order random)
RuboCop::Cop::Lint::LastKeywordArgument (order random)
RuboCop::Cop::Migration::AddColumnsToWideTables (order random)
RuboCop::Cop::Migration::AddColumnWithDefault (order random)
RuboCop::Cop::Migration::AddConcurrentForeignKey (order random)
RuboCop::Cop::Migration::AddConcurrentIndex (order random)
RuboCop::Cop::Migration::AddIndex (order random)
RuboCop::Cop::Migration::AddLimitToTextColumns (order random)
RuboCop::Cop::Migration::AddReference (order random)
RuboCop::Cop::Migration::AddTimestamps (order random)
RuboCop::Cop::Migration::BackgroundMigrationBaseClass (order random)
RuboCop::Cop::Migration::BackgroundMigrationRecord (order random)
RuboCop::Cop::Migration::BackgroundMigrations (order random)
RuboCop::Cop::Migration::ComplexIndexesRequireName (order random)
RuboCop::Cop::Migration::CreateTableWithForeignKeys (order random)
RuboCop::Cop::Migration::Datetime (order random)
RuboCop::Cop::Migration::DropTable (order random)
RuboCop::Cop::Migration::MigrationRecord (order random)
RuboCop::Cop::Migration::PreventGlobalEnableLockRetriesWithDisableDdlTransaction (order random)
RuboCop::Cop::Migration::PreventIndexCreation (order random)
RuboCop::Cop::Migration::PreventStrings (order random)
RuboCop::Cop::Migration::ReferToIndexByName (order random)
RuboCop::Cop::Migration::RemoveColumn (order random)
RuboCop::Cop::Migration::RemoveConcurrentIndex (order random)
RuboCop::Cop::Migration::RemoveIndex (order random)
RuboCop::Cop::Migration::SaferBooleanColumn (order random)
RuboCop::Cop::Migration::ScheduleAsync (order random)
RuboCop::Cop::Migration::SidekiqQueueMigrate (order random)
RuboCop::Cop::Migration::Timestamps (order random)
RuboCop::Cop::Migration::UpdateColumnInBatches (order random)
RuboCop::Cop::Migration::VersionedMigrationClass (order random)
RuboCop::Cop::Migration::WithLockRetriesDisallowedMethod (order random)
RuboCop::Cop::Migration::WithLockRetriesWithChange (order random)
RuboCop::Cop::Performance::ActiveRecordSubtransactionMethods (order random)
RuboCop::Cop::Performance::ActiveRecordSubtransactions (order random)
RuboCop::Cop::Performance::ARCountEach (order random)
RuboCop::Cop::Performance::ARExistsAndPresentBlank (order random)
RuboCop::Cop::Performance::ReadlinesEach (order random)
RuboCop::Cop::PreferClassMethodsOverModule (order random)
RuboCop::Cop::ProjectPathHelper (order random)
RuboCop::Cop::PutGroupRoutesUnderScope (order random)
RuboCop::Cop::PutProjectRoutesUnderScope (order random)
RuboCop::Cop::QA::AmbiguousPageObjectName (order random)
RuboCop::Cop::QA::ElementWithPattern (order random)
RuboCop::Cop::QA::SelectorUsage (order random)
RuboCop::Cop::RSpec::AnyInstanceOf (order random)
RuboCop::Cop::RSpec::BeSuccessMatcher (order random)
RuboCop::Cop::RSpec::EnvAssignment (order random)
RuboCop::Cop::RSpec::ExpectGitlabTracking (order random)
RuboCop::Cop::RSpec::FactoriesInMigrationSpecs (order random)
RuboCop::Cop::RSpec::FactoryBot::InlineAssociation (order random)
RuboCop::Cop::RSpec::HaveGitlabHttpStatus (order random)
RuboCop::Cop::RSpec::HTTPartyBasicAuth (order random)
RuboCop::Cop::RSpec::ModifySidekiqMiddleware (order random)
RuboCop::Cop::RSpec::TimecopFreeze (order random)
RuboCop::Cop::RSpec::TimecopTravel (order random)
RuboCop::Cop::RSpec::TopLevelDescribePath (order random)
RuboCop::Cop::RSpec::WebMockEnable (order random)
RuboCop::Cop::RubyInterpolationInTranslation (order random)
RuboCop::Cop::SafeParams (order random)
RuboCop::Cop::Scalability::BulkPerformWithContext (order random)
RuboCop::Cop::Scalability::CronWorkerContext (order random)
RuboCop::Cop::Scalability::FileUploads (order random)
RuboCop::Cop::Scalability::IdempotentWorker (order random)
RuboCop::Cop::SidekiqLoadBalancing::WorkerDataConsistency (order random)
RuboCop::Cop::SidekiqOptionsQueue (order random)
RuboCop::Cop::StaticTranslationDefinition (order random)
RuboCop::Cop::Style::RegexpLiteralMixedPreserve (order random)
RuboCop::CopTodo (order random)
RuboCop::Cop::UsageData::DistinctCountByLargeForeignKey (order random)
RuboCop::Cop::UsageData::HistogramWithLargeTable (order random)
RuboCop::Cop::UsageData::InstrumentationSuperclass (order random)
RuboCop::Cop::UsageData::LargeTable (order random)
RuboCop::Cop::UserAdmin (order random)
RuboCop::Formatter::TodoFormatter (order random)
RuboCop::MigrationHelpers (order random)
RuboCop::QAHelpers (order random)
RuboCop::TodoDir (order random)

How to set up and validate locally

bin/rspec spec/rubocop

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Peter Leitzen

Merge request reports