comparison gunzip_memcached.t @ 952:e9064d691790

Tests: converted tests to run in parallel.
author Andrey Zelenkov <zelenkov@nginx.com>
date Tue, 21 Jun 2016 16:39:13 +0300
parents cbd26265d9a3
children 882267679006
comparison
equal deleted inserted replaced
951:9361c7eddfc1 952:e9064d691790
40 40
41 http { 41 http {
42 %%TEST_GLOBALS_HTTP%% 42 %%TEST_GLOBALS_HTTP%%
43 43
44 server { 44 server {
45 listen 127.0.0.1:8080; 45 listen 127.0.0.1:%%PORT_0%%;
46 server_name localhost; 46 server_name localhost;
47 47
48 gunzip on; 48 gunzip on;
49 49
50 location / { 50 location / {
51 set $memcached_key $uri; 51 set $memcached_key $uri;
52 memcached_pass 127.0.0.1:8081; 52 memcached_pass 127.0.0.1:%%PORT_1%%;
53 memcached_gzip_flag 2; 53 memcached_gzip_flag 2;
54 } 54 }
55 } 55 }
56 } 56 }
57 57
60 my $memhelp = `memcached -h`; 60 my $memhelp = `memcached -h`;
61 my @memopts = (); 61 my @memopts = ();
62 62
63 if ($memhelp =~ /repcached/) { 63 if ($memhelp =~ /repcached/) {
64 # repcached patch adds additional listen socket 64 # repcached patch adds additional listen socket
65 push @memopts, '-X', '8082'; 65 push @memopts, '-X', port(2);
66 } 66 }
67 if ($memhelp =~ /-U/) { 67 if ($memhelp =~ /-U/) {
68 # UDP port is on by default in memcached 1.2.7+ 68 # UDP port is on by default in memcached 1.2.7+
69 push @memopts, '-U', '0'; 69 push @memopts, '-U', '0';
70 } 70 }
71 71
72 $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081', @memopts); 72 $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', port(1), @memopts);
73 73
74 $t->run()->plan(2); 74 $t->run()->plan(2);
75 75
76 $t->waitforsocket('127.0.0.1:8081') 76 $t->waitforsocket('127.0.0.1:' . port(1))
77 or die "Can't start memcached"; 77 or die "Can't start memcached";
78 78
79 # Put compressed value into memcached. This requires compress_threshold to be 79 # Put compressed value into memcached. This requires compress_threshold to be
80 # set and compressed value to be at least 20% less than original one. 80 # set and compressed value to be at least 20% less than original one.
81 81
82 my $memd = Cache::Memcached->new(servers => [ '127.0.0.1:8081' ], 82 my $memd = Cache::Memcached->new(servers => [ '127.0.0.1:' . port(1) ],
83 compress_threshold => 1, connect_timeout => 1.0); 83 compress_threshold => 1, connect_timeout => 1.0);
84 $memd->set('/', 'TEST' x 10) 84 $memd->set('/', 'TEST' x 10)
85 or die "can't put value into memcached: $!"; 85 or die "can't put value into memcached: $!";
86 86
87 ############################################################################### 87 ###############################################################################