summaryrefslogtreecommitdiff
path: root/t/lru-crawler.t
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2020-05-01 12:03:28 -0700
committerdormando <dormando@rydia.net>2020-05-01 12:03:28 -0700
commitf3c2aa653f779bde4e8d9b674ffe0fb817f36d6b (patch)
tree1537ec2ad59f26963b54a99c12e8348af96b9e09 /t/lru-crawler.t
parent4f2753909324c3532836926de647c301a1407f05 (diff)
downloadmemcached-f3c2aa653f779bde4e8d9b674ffe0fb817f36d6b.tar.gz
more flaky test fixes; crawler/restart
the restart test used an 8 second TTL then a 10 second sleep. Due to how the clock works in memcached they can overlap. Now uses a 5 second TTL. Need a better mechanism for doing this... Crawler test is doing a sleep/retry since settings struct isn't synchronized with the thread stop.
Diffstat (limited to 't/lru-crawler.t')
-rw-r--r--t/lru-crawler.t14
1 files changed, 12 insertions, 2 deletions
diff --git a/t/lru-crawler.t b/t/lru-crawler.t
index 8467a54..2075236 100644
--- a/t/lru-crawler.t
+++ b/t/lru-crawler.t
@@ -88,10 +88,20 @@ for (1 .. 30) {
print $sock "lru_crawler disable\r\n";
is(scalar <$sock>, "OK\r\n", "disabled lru crawler");
-{
+my $settings_match = 0;
+# TODO: we retry a few times since the settings value is changed
+# outside of a memory barrier, but the thread is stopped before the OK is
+# returned.
+# At some point better handling of the setings synchronization should happen.
+for (1 .. 10) {
my $stats = mem_stats($server->sock, ' settings');
- is($stats->{lru_crawler}, "no");
+ if ($stats->{lru_crawler} eq "no") {
+ $settings_match = 1;
+ last;
+ }
+ sleep 1;
}
+is($settings_match, 1, "settings output matches crawler state");
$server->stop;