Skip to content
Snippets Groups Projects
Unverified Commit 9d7f3b09 authored by Stan Hu's avatar Stan Hu
Browse files

Fix flaky restrict_gitlab_schema_spec.rb

This test was failing because `Feature.enabled?(:redis_hll_tracking)`
was called in the migration and expecting the `feature_names` database
table to be accessed. However, it wasn't accessed for two reasons:

1. In tests we stub out feature flag access and use an in-memory
cache. However, even though the test had `stub_feature_flags: false`
set in the metadata, a stale `Feature` was still memoized and had to be
cleared out.

2. With the feature flag stubs disabled, this enabled the Redis cache
for feature flags. We need to clear this out between tests to ensure
the database is hit.

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/416143
parent f65221e8
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -3,7 +3,7 @@
require 'spec_helper'
 
RSpec.describe Gitlab::Database::MigrationHelpers::RestrictGitlabSchema, query_analyzers: false,
stub_feature_flags: false, feature_category: :cell do
stub_feature_flags: false, use_clean_rails_redis_caching: true, feature_category: :cell do
let(:schema_class) { Class.new(Gitlab::Database::Migration[1.0]).include(described_class) }
 
# We keep only the GitlabSchemasValidateConnection analyzer running
Loading
Loading
Loading
Loading
@@ -22,6 +22,7 @@ def stub_all_feature_flags
 
def unstub_all_feature_flags
Feature.stub = false
Feature.reset_flipper
end
 
# Stub Feature flags with `flag_name: true/false`
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment