Mercurial > hg > nginx-tests
comparison gunzip_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 |
---|---|
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:%%PORT_0%%; | 45 listen 127.0.0.1:8080; |
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:%%PORT_1%%; | 52 memcached_pass 127.0.0.1:8081; |
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', 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 | 73 |
74 $t->run()->plan(2); | 74 $t->run()->plan(2); |
75 | 75 |
76 $t->waitforsocket('127.0.0.1:' . port(1)) | 76 $t->waitforsocket('127.0.0.1:' . port(8081)) |
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:' . port(1) ], | 82 my $memd = Cache::Memcached->new(servers => [ '127.0.0.1:' . port(8081) ], |
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 ############################################################################### |