diff options
Diffstat (limited to 't')
-rwxr-xr-x | t/stats.t | 4 | ||||
-rw-r--r-- | t/watcher.t | 31 |
2 files changed, 32 insertions, 3 deletions
@@ -28,9 +28,9 @@ if (MemcachedTest::enabled_tls_testing()) { # when TLS is enabled, stats contains additional keys: # - ssl_handshake_errors # - time_since_server_cert_refresh - is(scalar(keys(%$stats)), 82, "expected count of stats values"); + is(scalar(keys(%$stats)), 83, "expected count of stats values"); } else { - is(scalar(keys(%$stats)), 80, "expected count of stats values"); + is(scalar(keys(%$stats)), 81, "expected count of stats values"); } # Test initial state diff --git a/t/watcher.t b/t/watcher.t index c624fb9..4ae100d 100644 --- a/t/watcher.t +++ b/t/watcher.t @@ -5,7 +5,7 @@ use strict; use warnings; use Socket qw/SO_RCVBUF/; -use Test::More tests => 25; +use Test::More tests => 30; use FindBin qw($Bin); use lib "$Bin/lib"; use MemcachedTest; @@ -192,6 +192,35 @@ SKIP: { "logged item get with correct size"); } +# test watcher stats +{ + my $stats_server = new_memcached('-m 60 -o watcher_logbuf_size=8'); + my $stats_client = $stats_server->sock; + my $stats; + + my $watcher1 = $stats_server->new_sock; + print $watcher1 "watch fetchers\n"; + $res = <$watcher1>; + is($res, "OK\r\n", 'fetchers watcher enabled'); + sleep 1; + $stats = mem_stats($stats_client); + is($stats->{log_watchers}, 1, 'tracked new fetchers watcher'); + + my $watcher2 = $stats_server->new_sock; + print $watcher2 "watch fetchers\n"; + $res = <$watcher2>; + is($res, "OK\r\n", 'mutations watcher enabled'); + sleep 1; + $stats = mem_stats($stats_client); + is($stats->{log_watchers}, 2, 'tracked new mutations watcher'); + + $watcher1->close(); + $watcher2->close(); + sleep 1; + $stats = mem_stats($stats_client); + is($stats->{log_watchers}, 0, 'untracked all watchers'); +} + # test no_watch option { my $nowatch_server = new_memcached('-W'); |