Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-10 21:09:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-10 21:09:54 +0300
commit350fd8b878fe930b83c52ccae82f861cc499776a (patch)
treeaa01a35b06921103ba9967920165419accb9f72d /spec/lib/gitlab/redis
parent70732753863e569f95ed954ca3c41421292f912b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/redis')
-rw-r--r--spec/lib/gitlab/redis/hll_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/lib/gitlab/redis/hll_spec.rb b/spec/lib/gitlab/redis/hll_spec.rb
new file mode 100644
index 00000000000..51768dd81c1
--- /dev/null
+++ b/spec/lib/gitlab/redis/hll_spec.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Redis::HLL, :clean_gitlab_redis_shared_state do
+ describe '.add' do
+ it 'raise an error when using an invalid key format' do
+ expect { described_class.add(key: 'test', value: 1, expiry: 1.day) }.to raise_error(Gitlab::Redis::HLL::KeyFormatError)
+ expect { described_class.add(key: 'test-{metric', value: 1, expiry: 1.day) }.to raise_error(Gitlab::Redis::HLL::KeyFormatError)
+ expect { described_class.add(key: 'test-{metric}}', value: 1, expiry: 1.day) }.to raise_error(Gitlab::Redis::HLL::KeyFormatError)
+ end
+
+ it "doesn't raise error when having correct format" do
+ expect { described_class.add(key: 'test-{metric}', value: 1, expiry: 1.day) }.not_to raise_error
+ expect { described_class.add(key: 'test-{metric}-1', value: 1, expiry: 1.day) }.not_to raise_error
+ expect { described_class.add(key: 'test:{metric}-1', value: 1, expiry: 1.day) }.not_to raise_error
+ expect { described_class.add(key: '2020-216-{project_action}', value: 1, expiry: 1.day) }.not_to raise_error
+ expect { described_class.add(key: 'i_{analytics}_dev_ops_score-2020-32', value: 1, expiry: 1.day) }.not_to raise_error
+ end
+ end
+end