Skip to content

Commit 526da16

Browse files
Hector Vidotkan145
authored andcommitted
resty-ctx.t conversion to APIcast::Blackbox
1 parent 0275f31 commit 526da16

File tree

1 file changed

+34
-17
lines changed

1 file changed

+34
-17
lines changed

t/resty-ctx.t

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
use lib 't';
2-
use Test::APIcast 'no_plan';
2+
use Test::APIcast::Blackbox 'no_plan';
33

4+
repeat_each(1);
45
run_tests();
56

67
__DATA__
78
89
=== TEST 1: get context reference
910
get context reference number
10-
--- http_config
11-
lua_package_path "$TEST_NGINX_LUA_PATH";
12-
--- config
13-
location = /t {
14-
content_by_lua_block {
15-
ngx.say(require('resty.ctx').ref())
16-
}
11+
--- configuration
12+
{}
13+
--- upstream
14+
location = /t {
15+
content_by_lua_block {
16+
ngx.say(require('resty.ctx').ref())
1717
}
18+
}
19+
--- upstream_name
20+
ctx
21+
--- more_headers
22+
Host: ctx
1823
--- request
1924
GET /t
2025
--- response_body
@@ -25,9 +30,9 @@ GET /t
2530
2631
2732
=== TEST 2: stash context reference
28-
--- http_config
29-
lua_package_path "$TEST_NGINX_LUA_PATH";
30-
--- config
33+
--- configuration
34+
{}
35+
--- upstream
3136
set $ctx_ref -1;
3237
3338
location = /t {
@@ -39,6 +44,10 @@ GET /t
3944
ngx.say(ngx.var.ctx_ref)
4045
}
4146
}
47+
--- upstream_name
48+
ctx
49+
--- more_headers
50+
Host: ctx
4251
--- request
4352
GET /t
4453
--- response_body
@@ -49,9 +58,9 @@ GET /t
4958
5059
5160
=== TEST 3: apply context reference
52-
--- http_config
53-
lua_package_path "$TEST_NGINX_LUA_PATH";
54-
--- config
61+
--- configuration
62+
{}
63+
--- upstream
5564
set $ctx_ref -1;
5665
5766
location = /t {
@@ -73,6 +82,10 @@ GET /t
7382
ngx.say(ngx.ctx.foo)
7483
}
7584
}
85+
--- upstream_name
86+
ctx
87+
--- more_headers
88+
Host: ctx
7689
--- request
7790
GET /t
7891
--- response_body
@@ -83,9 +96,9 @@ bar
8396
8497
8598
=== TEST 4: context is not garbage collected
86-
--- http_config
87-
lua_package_path "$TEST_NGINX_LUA_PATH";
88-
--- config
99+
--- configuration
100+
{}
101+
--- upstream
89102
set $ctx_ref -1;
90103
91104
location = /t {
@@ -126,6 +139,10 @@ bar
126139
ngx.say(ngx.ctx.foo)
127140
}
128141
}
142+
--- upstream_name
143+
ctx
144+
--- more_headers
145+
Host: ctx
129146
--- request
130147
GET /t
131148
--- response_body

0 commit comments

Comments
 (0)