comparison memcached.t @ 974:882267679006

Tests: simplified parallel modifications in tests. Mail tests were simplified in c227348453db.
author Andrey Zelenkov <zelenkov@nginx.com>
date Tue, 12 Jul 2016 17:39:03 +0300
parents e9064d691790
children
comparison
equal deleted inserted replaced
973:7d7aef8b9f3a 974:882267679006
37 37
38 http { 38 http {
39 %%TEST_GLOBALS_HTTP%% 39 %%TEST_GLOBALS_HTTP%%
40 40
41 server { 41 server {
42 listen 127.0.0.1:%%PORT_0%%; 42 listen 127.0.0.1:8080;
43 server_name localhost; 43 server_name localhost;
44 44
45 location / { 45 location / {
46 set $memcached_key $uri; 46 set $memcached_key $uri;
47 memcached_pass 127.0.0.1:%%PORT_1%%; 47 memcached_pass 127.0.0.1:8081;
48 } 48 }
49 49
50 location /next { 50 location /next {
51 set $memcached_key $uri; 51 set $memcached_key $uri;
52 memcached_next_upstream not_found; 52 memcached_next_upstream not_found;
53 memcached_pass 127.0.0.1:%%PORT_1%%; 53 memcached_pass 127.0.0.1:8081;
54 } 54 }
55 } 55 }
56 } 56 }
57 57
58 EOF 58 EOF
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', port(2); 65 push @memopts, '-X', port(8082);
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', port(1), @memopts); 72 $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', port(8081), @memopts);
73 $t->run(); 73 $t->run();
74 74
75 $t->waitforsocket('127.0.0.1:' . port(1)) 75 $t->waitforsocket('127.0.0.1:' . port(8081))
76 or die "Can't start memcached"; 76 or die "Can't start memcached";
77 77
78 ############################################################################### 78 ###############################################################################
79 79
80 my $memd = Cache::Memcached->new(servers => [ '127.0.0.1:' . port(1) ], 80 my $memd = Cache::Memcached->new(servers => [ '127.0.0.1:' . port(8081) ],
81 connect_timeout => 1.0); 81 connect_timeout => 1.0);
82 $memd->set('/', 'SEE-THIS') 82 $memd->set('/', 'SEE-THIS')
83 or die "can't put value into memcached: $!"; 83 or die "can't put value into memcached: $!";
84 84
85 like(http_get('/'), qr/SEE-THIS/, 'memcached request'); 85 like(http_get('/'), qr/SEE-THIS/, 'memcached request');