summaryrefslogtreecommitdiff
path: root/spec/support/redis_without_keys.rb
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-10-16 11:38:01 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-17 12:47:20 +0200
commitc365dea887ae0f139cf99e36701a2e4ca08ec0b9 (patch)
treeeb4e12709429b6ada718376ed3e6135a98e089c3 /spec/support/redis_without_keys.rb
parenta854431c6f08386f1a265c524f7dfdba4c59368a (diff)
downloadgitlab-ce-c365dea887ae0f139cf99e36701a2e4ca08ec0b9.tar.gz
Don't use `Redis#keys` in the circuitbreakerbvl-do-not-use-redis-keys
Diffstat (limited to 'spec/support/redis_without_keys.rb')
-rw-r--r--spec/support/redis_without_keys.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/support/redis_without_keys.rb b/spec/support/redis_without_keys.rb
new file mode 100644
index 00000000000..6220167dee6
--- /dev/null
+++ b/spec/support/redis_without_keys.rb
@@ -0,0 +1,8 @@
+class Redis
+ ForbiddenCommand = Class.new(StandardError)
+
+ def keys(*args)
+ raise ForbiddenCommand.new("Don't use `Redis#keys` as it iterates over all "\
+ "keys in redis. Use `Redis#scan_each` instead.")
+ end
+end