summaryrefslogtreecommitdiff
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
commitb39512ed755239198a9c294b6a45e65c05900235 (patch)
treed234a3efade1de67c46b9e5a38ce813627726aa7 /spec/spec_helper.rb
parentd31474cf3b17ece37939d20082b07f6657cc79a9 (diff)
downloadgitlab-ce-b39512ed755239198a9c294b6a45e65c05900235.tar.gz
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb27
1 files changed, 23 insertions, 4 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 47cd78873f8..8acf3bcf9c0 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -53,10 +53,8 @@ end
require 'rainbow/ext/string'
Rainbow.enabled = false
-# Require JH first because we need override some EE methods with JH methods,
-# if we load EE first, we can't find JH modules in prepend_mod method
-require_relative('../jh/spec/spec_helper') if Gitlab.jh?
require_relative('../ee/spec/spec_helper') if Gitlab.ee?
+require_relative('../jh/spec/spec_helper') if Gitlab.jh?
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
@@ -161,7 +159,6 @@ RSpec.configure do |config|
config.include LicenseHelpers
config.include ActiveJob::TestHelper
config.include ActiveSupport::Testing::TimeHelpers
- config.include CycleAnalyticsHelpers
config.include FactoryBot::Syntax::Methods
config.include FixtureHelpers
config.include NonExistingRecordsHelpers
@@ -208,6 +205,7 @@ RSpec.configure do |config|
include StubFeatureFlags
include StubSnowplow
+ include StubMember
if ENV['CI'] || ENV['RETRIES']
# This includes the first try, i.e. tests will be run 4 times before failing.
@@ -334,6 +332,9 @@ RSpec.configure do |config|
# See https://docs.gitlab.com/ee/development/feature_flags/#selectively-disable-by-actor
stub_feature_flags(legacy_merge_request_state_check_for_merged_result_pipelines: false)
+ # Will be removed in https://gitlab.com/gitlab-org/gitlab/-/issues/369875
+ stub_feature_flags(override_group_level_protected_environment_settings_permission: false)
+
allow(Gitlab::GitalyClient).to receive(:can_use_disk?).and_return(enable_rugged)
else
unstub_all_feature_flags
@@ -391,6 +392,11 @@ RSpec.configure do |config|
Gitlab::WithRequestStore.with_request_store { example.run }
end
+ config.around(:example, :enable_rugged) do |example|
+ # Skip tests that need rugged when using praefect DB.
+ example.run unless GitalySetup.praefect_with_db?
+ end
+
# previous test runs may have left some resources throttled
config.before do
::Gitlab::ExclusiveLease.reset_all!("el:throttle:*")
@@ -505,3 +511,16 @@ module TouchRackUploadedFile
end
Rack::Test::UploadedFile.prepend(TouchRackUploadedFile)
+
+# Monkey-patch to enable ActiveSupport::Notifications for Redis commands
+module RedisCommands
+ module Instrumentation
+ def process(commands, &block)
+ ActiveSupport::Notifications.instrument('redis.process_commands', commands: commands) do
+ super(commands, &block)
+ end
+ end
+ end
+end
+
+Redis::Client.prepend(RedisCommands::Instrumentation)