diff options
author | dormando <dormando@rydia.net> | 2023-04-28 12:34:58 -0700 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2023-04-28 12:34:58 -0700 |
commit | 6350e44292a9b72f9b1f9b4dce572903ae2ade14 (patch) | |
tree | 2c92d24985eaf15260e16fbcca01f9b7285518c0 | |
parent | 24bf90cff7548c0becb0fee3213c274a9fb29ee5 (diff) | |
download | memcached-6350e44292a9b72f9b1f9b4dce572903ae2ade14.tar.gz |
proxy: let tests use unix socket for proxy daemon
A long sleep in the unix startup code made backends hit the connection
timeout before the backends were configured.
Make all the proxy tests use the unix socket instead of listening on a
hardcoded port. Proxy code is completely equivalent from the client
standpoint.
This fix should make the whole test suite run a bit faster too.
-rw-r--r-- | t/lib/MemcachedTest.pm | 5 | ||||
-rw-r--r-- | t/proxy.t | 2 | ||||
-rw-r--r-- | t/proxyconfig.t | 4 | ||||
-rw-r--r-- | t/proxyinternal.t | 2 | ||||
-rw-r--r-- | t/proxyunits.t | 2 |
5 files changed, 7 insertions, 8 deletions
diff --git a/t/lib/MemcachedTest.pm b/t/lib/MemcachedTest.pm index a9557e5..d917bf2 100644 --- a/t/lib/MemcachedTest.pm +++ b/t/lib/MemcachedTest.pm @@ -352,8 +352,7 @@ sub new_memcached { # A slow/emulated/valgrinded/etc system may take longer than a second # for the unix socket to appear. my $filename = $1; - for (1..20) { - sleep 1; + for (1..60) { my $conn = IO::Socket::UNIX->new(Peer => $filename); if ($conn) { @@ -364,7 +363,7 @@ sub new_memcached { port => $port); } else { croak("Failed to connect to unix socket: memcached not running") unless is_running($childpid); - sleep 1; + select undef, undef, undef, 0.20; } } croak("Failed to connect to unix domain socket: $! '$filename'") if $@; @@ -31,7 +31,7 @@ for (2 .. 6) { } #my $sock = $srv->sock; -my $p_srv = new_memcached('-o proxy_config=./t/startfile.lua -l 127.0.0.1', 11211); +my $p_srv = new_memcached('-o proxy_config=./t/startfile.lua'); my $p_sock = $p_srv->sock; # hack to help me use T_MEMD_USE_DAEMON for proxy. diff --git a/t/proxyconfig.t b/t/proxyconfig.t index 5ea8d48..1f3158a 100644 --- a/t/proxyconfig.t +++ b/t/proxyconfig.t @@ -70,12 +70,12 @@ for my $port (11511, 11512, 11513) { diag "testing failure to start"; write_modefile("invalid syntax"); eval { - my $p_srv = new_memcached('-o proxy_config=./t/proxyconfig.lua -l 127.0.0.1', 11510); + my $p_srv = new_memcached('-o proxy_config=./t/proxyconfig.lua'); }; ok($@ && $@ =~ m/Failed to connect/, "server successfully not started"); write_modefile('return "none"'); -my $p_srv = new_memcached('-o proxy_config=./t/proxyconfig.lua -l 127.0.0.1', 11510); +my $p_srv = new_memcached('-o proxy_config=./t/proxyconfig.lua'); my $ps = $p_srv->sock; $ps->autoflush(1); diff --git a/t/proxyinternal.t b/t/proxyinternal.t index c9bb8ed..66c0600 100644 --- a/t/proxyinternal.t +++ b/t/proxyinternal.t @@ -53,7 +53,7 @@ for my $port (11611, 11612, 11613) { push(@mocksrvs, $srv); } -my $p_srv = new_memcached("-o proxy_config=./t/proxyinternal.lua,ext_item_size=500,ext_item_age=1,ext_path=$ext_path:64m,ext_max_sleep=100000 -l 127.0.0.1 -U 0", 11510); +my $p_srv = new_memcached("-o proxy_config=./t/proxyinternal.lua,ext_item_size=500,ext_item_age=1,ext_path=$ext_path:64m,ext_max_sleep=100000"); my $ps = $p_srv->sock; $ps->autoflush(1); diff --git a/t/proxyunits.t b/t/proxyunits.t index 49594bf..992e73e 100644 --- a/t/proxyunits.t +++ b/t/proxyunits.t @@ -45,7 +45,7 @@ for my $port (11411, 11412, 11413) { push(@mocksrvs, $srv); } -my $p_srv = new_memcached('-o proxy_config=./t/proxyunits.lua -l 127.0.0.1', 11410); +my $p_srv = new_memcached('-o proxy_config=./t/proxyunits.lua'); my $ps = $p_srv->sock; $ps->autoflush(1); |