summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2022-02-09 12:52:26 -0800
committerdormando <dormando@rydia.net>2022-02-09 12:52:26 -0800
commitcbb8efb4dd1c4d3c9a9f4dcfe82d6f9f28005df9 (patch)
treead36a89f41544c0954f412ebd0aa50c44a1bafbd
parentf393a1aaccc8dbdc31095123fb54ae65782ea00a (diff)
downloadmemcached-cbb8efb4dd1c4d3c9a9f4dcfe82d6f9f28005df9.tar.gz
tests: repair race in maxconns.t test
lsitener thread may not have actually accepted everything by the time we start closing them, so it might not show rejected connections.
-rwxr-xr-xt/maxconns.t13
1 files changed, 11 insertions, 2 deletions
diff --git a/t/maxconns.t b/t/maxconns.t
index 7e75615..816d76f 100755
--- a/t/maxconns.t
+++ b/t/maxconns.t
@@ -44,12 +44,21 @@ sub test_maxconns {
}
}
+ my $failed = 1;
+ for (1 .. 5) {
+ $stats = mem_stats($stat_sock);
+ if ($stats->{rejected_connections} != 0) {
+ $failed = 0;
+ last;
+ }
+ sleep 1;
+ }
+ is($failed, 0, "rejected connections were observed.");
+
for my $s (@sockets) {
$s->close();
}
- $stats = mem_stats($stat_sock);
- cmp_ok($stats->{rejected_connections}, '>', '1', 'rejected connections recorded');
$server->stop;
$stat_sock->close();
}