diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/lib/gitlab/cache | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/lib/gitlab/cache')
-rw-r--r-- | spec/lib/gitlab/cache/import/caching_spec.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/lib/gitlab/cache/import/caching_spec.rb b/spec/lib/gitlab/cache/import/caching_spec.rb index e4aec0f4dec..7b4308d32ae 100644 --- a/spec/lib/gitlab/cache/import/caching_spec.rb +++ b/spec/lib/gitlab/cache/import/caching_spec.rb @@ -89,7 +89,7 @@ describe Gitlab::Cache::Import::Caching, :clean_gitlab_redis_cache do end describe '.write_multiple' do - it 'sets multiple keys' do + it 'sets multiple keys when key_prefix not set' do mapping = { 'foo' => 10, 'bar' => 20 } described_class.write_multiple(mapping) @@ -101,6 +101,19 @@ describe Gitlab::Cache::Import::Caching, :clean_gitlab_redis_cache do expect(found).to eq(value.to_s) end end + + it 'sets multiple keys with correct prefix' do + mapping = { 'foo' => 10, 'bar' => 20 } + + described_class.write_multiple(mapping, key_prefix: 'pref/') + + mapping.each do |key, value| + full_key = described_class.cache_key_for("pref/#{key}") + found = Gitlab::Redis::Cache.with { |r| r.get(full_key) } + + expect(found).to eq(value.to_s) + end + end end describe '.expire' do |