Allow the primary GDK to run tests that need a Geo tracking DB
What does this merge request do and why?
Allow the primary GDK to run tests that need a Geo tracking DB.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
Set up Geo. Or this might work in
gdk.yml
:--- geo: enabled: true
-
Check out this merge request's branch.
-
Try to run a test that needs the Geo tracking database:
❯ bin/rspec ee/spec/models/geo/package_file_registry_spec.rb:39 Running via Spring preloader in process 17645 Run options: include {:focus=>true, :locations=>{"./ee/spec/models/geo/package_file_registry_spec.rb"=>[39]}} Test environment set up in 1.769237 seconds F Failures: 1) Geo::PackageFileRegistry.find_registry_differences with selective sync disabled finds unused and untracked items Failure/Error: super Geo::TrackingBase::SecondaryNotConfigured: Geo secondary database is not configured # ./ee/app/models/geo/tracking_base.rb:26:in `connection' # ./app/models/concerns/sha_attribute.rb:52:in `load_schema!' # ./ee/spec/models/geo/package_file_registry_spec.rb:32:in `block (3 levels) in <main>' # ./spec/spec_helper.rb:451:in `block (3 levels) in <main>' # ./lib/gitlab/sidekiq_sharding/validator.rb:42:in `enabled' # ./spec/spec_helper.rb:450:in `block (2 levels) in <main>' # ./spec/spec_helper.rb:445:in `block (3 levels) in <main>' # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware' # ./spec/spec_helper.rb:436:in `block (2 levels) in <main>' # ./spec/spec_helper.rb:432:in `block (3 levels) in <main>' # ./lib/gitlab/application_context.rb:70:in `with_raw_context' # ./spec/spec_helper.rb:432:in `block (2 levels) in <main>' # ./spec/spec_helper.rb:261:in `block (2 levels) in <main>' # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>' # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <main>' # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented' # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <main>' # -e:1:in `<main>' Finished in 5.65 seconds (files took 2.71 seconds to load) 1 example, 1 failure Failed examples: rspec ./ee/spec/models/geo/package_file_registry_spec.rb:39 # Geo::PackageFileRegistry.find_registry_differences with selective sync disabled finds unused and untracked items Randomized with seed 56370 [TEST PROF INFO] Time spent in factories: 00:01.475 (18.33% of total time)
-
Run
gdk reconfigure
to check if regenerating all configuration is successful.-------------------------------------------------------------------------------- Ensuring GDK managed configuration files are up-to-date -------------------------------------------------------------------------------- 'gitlab/config/database.yml' has incoming changes: ------------------------------------------------------------------------------------------------------------- @@ -45,3 +45,12 @@ test: &test prepared_statements: false variables: statement_timeout: 120s + geo: + adapter: postgresql + encoding: unicode + database: gitlabhq_geo_test + database_tasks: true + host: /Users/mkozonogitlab/Developer/gdk/postgresql + port: 5432 + pool: 5 + gssencmode: disable -------------------------------------------------------------------------------------------------------------
-
cd gitlab
-
Try to run the same test again:
❯ bin/rspec ee/spec/models/geo/package_file_registry_spec.rb:39 Running via Spring preloader in process 19930 Run options: include {:focus=>true, :locations=>{"./ee/spec/models/geo/package_file_registry_spec.rb"=>[39]}} Test environment set up in 2.339754 seconds . Finished in 6.82 seconds (files took 2.37 seconds to load) 1 example, 0 failures Randomized with seed 27286 [TEST PROF INFO] Time spent in factories: 00:02.002 (22.54% of total time)
Impacted categories
The following categories relate to this merge request:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
Merge request checklist
-
This change is backward compatible. If not, please include steps to communicate to our users. - [-] Tests added for new functionality. If not, please raise an issue to follow-up.
-
Documentation added/updated, if needed. - [-] Announcement added, if change is notable.
- [-]
gdk doctor
test added, if needed. - [-] Add the
~highlight
label if this MR should be included in theCHANGELOG.md
.