Flaky or broken test ee/spec/lib/ee/gitlab/usage_data_counters/hll_redis_counter_spec.rb[1:1:1] # Gitlab::UsageDataCounters::HLLRedisCounter .categories gets all unique category names

Summary

It seems the test is actually broken. It's reported as flaky in the flaky tests report (even though the test description is wrongly set to Gitlab::UsageDataCounters::HLLRedisCounter.known_events returns both ee and ce events ): https://gitlab-org.gitlab.io/gitlab/rspec/flaky/report-suite.json.

Steps to reproduce

bin/rspec -f doc 'ee/spec/lib/ee/gitlab/usage_data_counters/hll_redis_counter_spec.rb[1:1:1]'
Running via Spring preloader in process 39203
warning: parser/current is loading parser/ruby27, which recognizes2.7.6-compliant syntax, but you are running 2.7.5.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Run options: include {:focus=>true, :ids=>{"./ee/spec/lib/ee/gitlab/usage_data_counters/hll_redis_counter_spec.rb"=>["1:1:1"]}}

Test environment set up in 9.106303 seconds

Gitlab::UsageDataCounters::HLLRedisCounter
  .categories
    gets all unique category names (FAILED - 1)

Failures:

  1) Gitlab::UsageDataCounters::HLLRedisCounter.categories gets all unique category names
     Failure/Error:
       expect(described_class.categories).to contain_exactly(
         'deploy_token_packages',
         'user_packages',
         'compliance',
         'ecosystem',
         'analytics',
         'ide_edit',
         'search',
         'source_code',
         'incident_management',
     
       expected collection contained:  ["analytics", "ci_secrets_management", "ci_templates", "ci_users", "code_review", "compliance", "depl...search", "secure", "snippets", "source_code", "terraform", "testing", "user_packages", "work_items"]
       actual collection contained:    ["analytics", "ci_secrets_management", "ci_templates", "ci_users", "code_review", "compliance", "depl...search", "secure", "snippets", "source_code", "terraform", "testing", "user_packages", "work_items"]
       the extra elements were:        ["environments", "integrations", "kubernetes_agent"]
     # ./ee/spec/lib/ee/gitlab/usage_data_counters/hll_redis_counter_spec.rb:41:in `block (3 levels) in <main>'
     # ./ee/spec/lib/ee/gitlab/usage_data_counters/hll_redis_counter_spec.rb:35:in `block (3 levels) in <main>'
     # ./ee/spec/lib/ee/gitlab/usage_data_counters/hll_redis_counter_spec.rb:35:in `block (2 levels) in <main>'
     # ./spec/spec_helper.rb:412:in `block (3 levels) in <main>'
     # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:404:in `block (2 levels) in <main>'
     # ./spec/spec_helper.rb:400:in `block (3 levels) in <main>'
     # ./lib/gitlab/application_context.rb:59:in `with_raw_context'
     # ./spec/spec_helper.rb:400:in `block (2 levels) in <main>'
     # ./spec/spec_helper.rb:240:in `block (2 levels) in <main>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
     # ./spec/support/redis.rb:17:in `block (3 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 11.84 seconds (files took 4.04 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./ee/spec/lib/ee/gitlab/usage_data_counters/hll_redis_counter_spec.rb:40 # Gitlab::UsageDataCounters::HLLRedisCounter.categories gets all unique category names

Proposed Resolution

Please refer to the Resolution guidance to learn more about resolution of broken master.