File: used.t

package info (click to toggle)
libnginx-mod-http-memc 0.20-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 424 kB
  • sloc: ansic: 2,905; perl: 120; sh: 115; makefile: 9
file content (67 lines) | stat: -rw-r--r-- 1,297 bytes parent folder | download | duplicates (3)
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]