File tree Expand file tree Collapse file tree 1 file changed +84
-0
lines changed Expand file tree Collapse file tree 1 file changed +84
-0
lines changed Original file line number Diff line number Diff line change
1
+ # vi:filetype=
2
+
3
+ use lib ' lib' ;
4
+ use Test::Nginx::Socket;
5
+
6
+ # repeat_each(2);
7
+
8
+ plan tests => repeat_each() * (5 * blocks());
9
+
10
+ $ENV {TEST_NGINX_MEMCACHED_PORT } ||= 11211;
11
+
12
+ no_long_string();
13
+
14
+ # master_on();
15
+ no_shuffle();
16
+
17
+ run_tests();
18
+
19
+ __DATA__
20
+
21
+ === TEST 1: flush all
22
+ --- config
23
+ location /flush {
24
+ set $memc_cmd 'flush_all';
25
+ memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT;
26
+ }
27
+ --- response_headers
28
+ Content-Type: text/plain
29
+ Content-Length: 4
30
+ !Foo-Bar
31
+ --- request
32
+ GET /flush
33
+ --- response_body eval: "OK\r\n"
34
+
35
+
36
+
37
+ === TEST 2: basic fetch (http 1.0)
38
+ --- config
39
+ location /foo {
40
+ default_type text/css;
41
+ srcache_fetch GET /memc $uri;
42
+ srcache_store PUT /memc $uri;
43
+
44
+ echo hello;
45
+ }
46
+
47
+ location /memc {
48
+ internal;
49
+
50
+ set $memc_key $query_string;
51
+ set $memc_exptime 300;
52
+ memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT;
53
+ }
54
+ --- request
55
+ GET /foo HTTP/1.0
56
+ --- response_headers
57
+ Content-Type: text/css
58
+ Content-Length: 6
59
+ --- response_body
60
+ hello
61
+
62
+
63
+
64
+ === TEST 3: inspect the cached item
65
+ --- config
66
+ location /memc {
67
+ set $memc_key "/foo";
68
+ set $memc_exptime 300;
69
+ memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT;
70
+ }
71
+ --- request
72
+ GET /memc
73
+ --- response_headers
74
+ Content-Type: text/plain
75
+ Content-Length: 49
76
+ !Set-Cookie
77
+ !Proxy-Authenticate
78
+ --- response_body eval
79
+ "HTTP/1.1 200 OK\r
80
+ Content-Type: text/css\r
81
+ \r
82
+ hello
83
+ "
84
+
You can’t perform that action at this time.
0 commit comments