Skip to content

Commit 6c629a1

Browse files
committed
added t/disk.t for disk file caching.
1 parent 0f0526a commit 6c629a1

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

t/disk.t

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# vi:filetype=
2+
3+
use lib 'lib';
4+
use Test::Nginx::Socket;
5+
6+
#repeat_each(100);
7+
8+
plan tests => repeat_each() * 2 * blocks();
9+
10+
$ENV{TEST_NGINX_MEMCACHED_PORT} ||= 11211;
11+
12+
no_shuffle();
13+
14+
run_tests();
15+
16+
__DATA__
17+
18+
=== TEST 1: flush all
19+
--- config
20+
location /flush {
21+
set $memc_cmd 'flush_all';
22+
memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT;
23+
}
24+
--- request
25+
GET /flush
26+
--- response_body eval: "OK\r\n"
27+
28+
29+
30+
=== TEST 2: cache miss
31+
--- config
32+
location /index.html {
33+
srcache_fetch GET /memc $uri;
34+
srcache_store PUT /memc $uri;
35+
}
36+
37+
location /memc {
38+
internal;
39+
40+
set $memc_key $query_string;
41+
set $memc_exptime 300;
42+
memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT;
43+
}
44+
--- request
45+
GET /index.html
46+
--- response_body_like: It works!
47+
48+
49+
50+
=== TEST 3: cache hit
51+
--- config
52+
location /index.html {
53+
srcache_fetch GET /memc $uri;
54+
srcache_store PUT /memc $uri;
55+
}
56+
57+
location /memc {
58+
internal;
59+
60+
set $memc_key $query_string;
61+
set $memc_exptime 300;
62+
memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT;
63+
}
64+
--- request
65+
GET /index.html
66+
--- response_body_like: It works!
67+

0 commit comments

Comments
 (0)