]> git.saurik.com Git - redis.git/commitdiff
Added test for client output buffer limit (hard limit).
authorantirez <antirez@gmail.com>
Wed, 25 Jan 2012 17:11:04 +0000 (18:11 +0100)
committerantirez <antirez@gmail.com>
Wed, 25 Jan 2012 17:11:04 +0000 (18:11 +0100)
tests/test_helper.tcl
tests/unit/obuf-limits.tcl [new file with mode: 0644]

index 13b59b92c96c31a6bc63d38d0efe2bf512d80f4a..ef128ae202d85be11b95295714d3a86079fe5717 100644 (file)
@@ -35,6 +35,7 @@ set ::all_tests {
     unit/scripting
     unit/maxmemory
     unit/introspection
+    unit/obuf-limits
 }
 # Index to the next test to run in the ::all_tests list.
 set ::next_test 0
diff --git a/tests/unit/obuf-limits.tcl b/tests/unit/obuf-limits.tcl
new file mode 100644 (file)
index 0000000..e687752
--- /dev/null
@@ -0,0 +1,21 @@
+start_server {tags {"obuf-limits"}} {
+    test {Test that client output buffer hard limit is enforced} {
+        r config set client-output-buffer-limit {pubsub 100000 0 0}
+        set rd1 [redis_deferring_client]
+
+        $rd1 subscribe foo
+        set reply [$rd1 read]
+        assert {$reply eq "subscribe foo 1"}
+
+        set omem 0
+        while 1 {
+            r publish foo bar
+            set clients [split [r client list] "\r\n"]
+            set c [split [lindex $clients 1] " "]
+            if {![regexp {omem=([0-9]+)} $c - omem]} break
+            if {$omem > 200000} break
+        }
+        assert {$omem >= 100000 && $omem < 200000}
+        $rd1 close
+    }
+}