Mercurial > hg > nginx-tests
comparison memcached_keepalive.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 | 6c0a5903d0ae |
children | 882267679006 |
comparison
equal
deleted
inserted
replaced
951:9361c7eddfc1 | 952:e9064d691790 |
---|---|
37 | 37 |
38 http { | 38 http { |
39 %%TEST_GLOBALS_HTTP%% | 39 %%TEST_GLOBALS_HTTP%% |
40 | 40 |
41 upstream memd { | 41 upstream memd { |
42 server 127.0.0.1:8081; | 42 server 127.0.0.1:%%PORT_1%%; |
43 keepalive 1; | 43 keepalive 1; |
44 } | 44 } |
45 | 45 |
46 upstream memd3 { | 46 upstream memd3 { |
47 server 127.0.0.1:8081; | 47 server 127.0.0.1:%%PORT_1%%; |
48 server 127.0.0.1:8082; | 48 server 127.0.0.1:%%PORT_2%%; |
49 keepalive 1; | 49 keepalive 1; |
50 } | 50 } |
51 | 51 |
52 upstream memd4 { | 52 upstream memd4 { |
53 server 127.0.0.1:8081; | 53 server 127.0.0.1:%%PORT_1%%; |
54 server 127.0.0.1:8082; | 54 server 127.0.0.1:%%PORT_2%%; |
55 keepalive 10; | 55 keepalive 10; |
56 } | 56 } |
57 | 57 |
58 server { | 58 server { |
59 listen 127.0.0.1:8080; | 59 listen 127.0.0.1:%%PORT_0%%; |
60 server_name localhost; | 60 server_name localhost; |
61 | 61 |
62 location / { | 62 location / { |
63 set $memcached_key $uri; | 63 set $memcached_key $uri; |
64 memcached_pass memd; | 64 memcached_pass memd; |
90 | 90 |
91 if ($memhelp =~ /repcached/) { | 91 if ($memhelp =~ /repcached/) { |
92 # repcached patches adds additional listen socket memcached | 92 # repcached patches adds additional listen socket memcached |
93 # that should be different too | 93 # that should be different too |
94 | 94 |
95 push @memopts1, '-X', '8091'; | 95 push @memopts1, '-X', port(3); |
96 push @memopts2, '-X', '8092'; | 96 push @memopts2, '-X', port(4); |
97 } | 97 } |
98 if ($memhelp =~ /-U/) { | 98 if ($memhelp =~ /-U/) { |
99 # UDP ports no longer off by default in memcached 1.2.7+ | 99 # UDP ports no longer off by default in memcached 1.2.7+ |
100 | 100 |
101 push @memopts1, '-U', '0'; | 101 push @memopts1, '-U', '0'; |
106 | 106 |
107 push @memopts1, '-t', '1'; | 107 push @memopts1, '-t', '1'; |
108 push @memopts2, '-t', '1'; | 108 push @memopts2, '-t', '1'; |
109 } | 109 } |
110 | 110 |
111 $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081', @memopts1); | 111 $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', port(1), @memopts1); |
112 $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082', @memopts2); | 112 $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', port(2), @memopts2); |
113 | 113 |
114 $t->run(); | 114 $t->run(); |
115 | 115 |
116 $t->waitforsocket('127.0.0.1:8081') | 116 $t->waitforsocket('127.0.0.1:' . port(1)) |
117 or die "Unable to start memcached"; | 117 or die "Unable to start memcached"; |
118 $t->waitforsocket('127.0.0.1:8082') | 118 $t->waitforsocket('127.0.0.1:' . port(2)) |
119 or die "Unable to start second memcached"; | 119 or die "Unable to start second memcached"; |
120 | 120 |
121 ############################################################################### | 121 ############################################################################### |
122 | 122 |
123 my $memd1 = Cache::Memcached->new(servers => [ '127.0.0.1:8081' ], | 123 my $memd1 = Cache::Memcached->new(servers => [ '127.0.0.1:' . port(1) ], |
124 connect_timeout => 1.0); | 124 connect_timeout => 1.0); |
125 my $memd2 = Cache::Memcached->new(servers => [ '127.0.0.1:8082' ], | 125 my $memd2 = Cache::Memcached->new(servers => [ '127.0.0.1:' . port(2) ], |
126 connect_timeout => 1.0); | 126 connect_timeout => 1.0); |
127 | 127 |
128 $memd1->set('/', 'SEE-THIS'); | 128 $memd1->set('/', 'SEE-THIS'); |
129 $memd2->set('/', 'SEE-THIS'); | 129 $memd2->set('/', 'SEE-THIS'); |
130 $memd1->set('/big', 'X' x 1000000); | 130 $memd1->set('/big', 'X' x 1000000); |