Skip to content

Reduce migration spec runtime - #5419

Draft
johha wants to merge 1 commit into
mainfrom
next-test-optimzation
Draft

Reduce migration spec runtime#5419
johha wants to merge 1 commit into
mainfrom
next-test-optimzation

Conversation

@johha

@johha johha commented Sep 3, 2026

Copy link
Copy Markdown
Contributor
  • Consolidate bigint step1/step3 shared contexts: 10→5 and 9→5 it blocks, cutting Sequel::Migrator.run calls per example group by ~50%
  • Replace CC model usage in add_annotation_label_uniqueness_spec with raw Sequel to eliminate per-spec schema introspection on MySQL (~22-28s saving)
  • Delete add_guid_and_timestamps_to_roles_join_tables_spec: tests a no-op migration against already-applied schema with no migration shared context
  • Switch label_selector_requirement_validator_spec to lightweight_spec_helper
  • Fix NoModelInSpecs rubocop cop to catch model usage through let variables
  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

@johha
johha force-pushed the next-test-optimzation branch 8 times, most recently from d20c2bd to 144fc48 Compare September 7, 2026 09:55
@johha johha changed the title Reduce migration spec runtime by consolidating it blocks Reduce migration spec runtime Sep 7, 2026
@johha
johha force-pushed the next-test-optimzation branch from e5ff76b to f80cc60 Compare September 7, 2026 14:26
Moves all migration specs off spec_helper (~11.6s load) onto the lightweight
migration_spec_helper (~0.4s load), saving ~33s wall clock per CI run.
Also consolidates multi-example it blocks and removes CC model usage where
the spec only needed raw DB access.

Changes to migration_spec_helper:
- Add require 'steno/steno', 'sequel/plugins/microsecond_timestamp_precision'
- Add require 'support/matchers/have_queried_db_times' and 'and_record_arguments'
- Add Config#get stub method to allow instance_double verification
- Set Sequel.default_timezone = :utc (was implicit via spec_helper)

Bigint shared contexts: replace no-op allow_any_instance_of(Config) stubs with
allow(Config).to receive(:config).and_return(migration_config) so opt_out?
correctly reflects skip_bigint_id_migration per test context.

Two specs remain on spec_helper (ensure_migrations_are_current,
streamline_annotation_key_prefix) due to TestConfig/Rake and MetadataHelpers deps.
@johha
johha force-pushed the next-test-optimzation branch from f80cc60 to faa6c77 Compare September 7, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant