diff options
author | dormando <dormando@rydia.net> | 2019-08-28 19:39:24 -0700 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2019-08-28 19:39:24 -0700 |
commit | 2702e4102e43c699073ee0d9cdfeba59be33639b (patch) | |
tree | 9768c60fdc49743b7f56a11c815de4fece8437b9 /t/watcher.t | |
parent | 50a855dd91e44a3a693a082fe4551babd2c6d5fe (diff) | |
download | memcached-2702e4102e43c699073ee0d9cdfeba59be33639b.tar.gz |
fix race in t/watcher.t
didn't notice this when merging... when on a single core system it's
likely the log thread hasn't dequeued everything, so the test can get
multiple lines. look for the right one.
Diffstat (limited to 't/watcher.t')
-rw-r--r-- | t/watcher.t | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/t/watcher.t b/t/watcher.t index dc869e5..57c4507 100644 --- a/t/watcher.t +++ b/t/watcher.t @@ -112,6 +112,11 @@ if ($res eq "STORED\r\n") { is($res, "OK\r\n", "mutations watcher enabled"); print $client "cas cas_watch_key 0 0 5 0\r\nvalue\r\n"; - my $log = <$watcher>; - like($log, qr/cmd=cas/, "correctly logged cas command"); + my $tries = 30; + my $found_cas = 0; + while (my $log = <$watcher>) { + $found_cas = 1 if ($log =~ m/cmd=cas/ && $log =~ m/cas_watch_key/); + last if ($tries-- == 0 || $found_cas); + } + is($found_cas, 1, "correctly logged cas command"); } |