Skip to content

Fix variable passing in redis-hll migration spec

Sylvester Chin requested to merge sc1-fix-redis-hll-migration-spec into master

What does this MR do and why?

This MR fixes how value is passed in to the set_redis_hll method in spec/migrations/20231204095802_change_i_code_review_create_mr_keys_from_redis_hll_to_redis_spec.rb. Currently, value: 7 would mean we pass {value: 7} to Gitlab::Redis::HLL.add(...). What the Redis server receives is PFADD <key> "{:value=>7}" instead of PFADD <key> 7.

Hashes are silently acceptable in redis v4.8.0 gem as .to_s is called on anything that is not an Array: https://github.com/redis/redis-rb/blob/v4.8.0/lib/redis/connection/command_helper.rb#L20

However, this will raise an error in in redis v5.x gem as seen in the failed job (https://gitlab.com/gitlab-org/gitlab/-/jobs/5808546686).

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Merge request reports