summaryrefslogtreecommitdiff
path: root/memc-nginx-module-0.20/t/used.t
blob: 4e7b2aef192bb29831fde4edea80b66e7de59018 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# vi:filetype=

use lib 'lib';
use Test::Nginx::Socket;

plan tests => repeat_each() * (4 * blocks());

$ENV{TEST_NGINX_MEMCACHED_PORT} ||= 11211;

#no_diff;

run_tests();

__DATA__

=== TEST 1: module not used
--- config
    location /t {
        content_by_lua '
            local v = ngx.var
            ngx.say(v.memc_cmd, v.memc_exptime, v.memc_value, v.memc_key, v.memc_flags)
        ';
    }
--- request
    GET /t
--- stap
F(ngx_http_memc_add_variable) {
    printf("memc add variable \"%s\"\n", user_string_n($name->data, $name->len))
}
--- stap_out
--- response_body
nilnilnilnilnil
--- no_error_log
[error]



=== TEST 2: module used
--- config
    location /t {
        content_by_lua '
            local v = ngx.var
            ngx.say(v.memc_cmd, v.memc_exptime, v.memc_value, v.memc_key, v.memc_flags)
        ';
    }
    location /bah {
        set $memc_key foo;
        memc_pass 127.0.0.1:11211;
    }
--- request
    GET /t
--- stap
F(ngx_http_memc_add_variable) {
    printf("memc add variable \"%s\"\n", user_string_n($name->data, $name->len))
}
--- stap_out
memc add variable "memc_key"
memc add variable "memc_cmd"
memc add variable "memc_flags"
memc add variable "memc_exptime"
memc add variable "memc_value"

--- response_body
nilnilnilnilnil
--- no_error_log
[error]