Commit 106795c6 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'always_set_env_var_use_model_load_balancing' into 'master'

Always set GITLAB_USE_MODEL_LOAD_BALANCING in test env

See merge request gitlab-org/gitlab!82562
parents f9551502 71bd0575
...@@ -24,10 +24,6 @@ ...@@ -24,10 +24,6 @@
.decomposed-database-rspec: .decomposed-database-rspec:
extends: .decomposed-database extends: .decomposed-database
variables:
# For decomposition phase 3, uncomment line below:
# GITLAB_LOAD_BALANCING_REUSE_PRIMARY_ci: "main"
GITLAB_USE_MODEL_LOAD_BALANCING: "true"
.rspec-base: .rspec-base:
extends: extends:
...@@ -381,6 +377,8 @@ db:migrate:reset decomposed: ...@@ -381,6 +377,8 @@ db:migrate:reset decomposed:
- db:migrate:reset - db:migrate:reset
- .decomposed-database - .decomposed-database
- .rails:rules:decomposed-databases - .rails:rules:decomposed-databases
variables:
GITLAB_USE_MODEL_LOAD_BALANCING: "false"
db:migrate-from-previous-major-version: db:migrate-from-previous-major-version:
extends: .db-job-base extends: .db-job-base
...@@ -389,6 +387,7 @@ db:migrate-from-previous-major-version: ...@@ -389,6 +387,7 @@ db:migrate-from-previous-major-version:
SETUP_DB: "false" SETUP_DB: "false"
PROJECT_TO_CHECKOUT: "gitlab-foss" PROJECT_TO_CHECKOUT: "gitlab-foss"
TAG_TO_CHECKOUT: "v13.12.9" TAG_TO_CHECKOUT: "v13.12.9"
GITLAB_USE_MODEL_LOAD_BALANCING: "false"
before_script: before_script:
- !reference [.default-before_script, before_script] - !reference [.default-before_script, before_script]
- '[[ -d "ee/" ]] || export PROJECT_TO_CHECKOUT="gitlab"' - '[[ -d "ee/" ]] || export PROJECT_TO_CHECKOUT="gitlab"'
......
...@@ -90,7 +90,8 @@ module Gitlab ...@@ -90,7 +90,8 @@ module Gitlab
def use_model_load_balancing? def use_model_load_balancing?
# Cache environment variable and return env variable first if defined # Cache environment variable and return env variable first if defined
use_model_load_balancing_env = Gitlab::Utils.to_boolean(ENV["GITLAB_USE_MODEL_LOAD_BALANCING"]) default_use_model_load_balancing_env = Gitlab.dev_or_test_env? || nil
use_model_load_balancing_env = Gitlab::Utils.to_boolean(ENV.fetch('GITLAB_USE_MODEL_LOAD_BALANCING', default_use_model_load_balancing_env))
unless use_model_load_balancing_env.nil? unless use_model_load_balancing_env.nil?
return use_model_load_balancing_env return use_model_load_balancing_env
......
...@@ -274,6 +274,8 @@ RSpec.describe Gitlab::Database::LoadBalancing::Setup do ...@@ -274,6 +274,8 @@ RSpec.describe Gitlab::Database::LoadBalancing::Setup do
end end
before do before do
allow(Gitlab).to receive(:dev_or_test_env?).and_return(false)
# Rewrite `class_attribute` to use rspec mocking and prevent modifying the objects # Rewrite `class_attribute` to use rspec mocking and prevent modifying the objects
allow_next_instance_of(described_class) do |setup| allow_next_instance_of(described_class) do |setup|
allow(setup).to receive(:configure_connection) allow(setup).to receive(:configure_connection)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment