Skip to content

Commit

Permalink
Merge pull request #1424 from hector-vido/conversion_black_box_resty_…
Browse files Browse the repository at this point in the history
…ctx-wrong

resty-ctx.t conversion to APIcast::Blackbox
  • Loading branch information
eguzki authored Nov 14, 2023
2 parents 99aef88 + 053591f commit ec973b7
Showing 1 changed file with 34 additions and 17 deletions.
51 changes: 34 additions & 17 deletions t/resty-ctx.t
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
use lib 't';
use Test::APIcast 'no_plan';
use Test::APIcast::Blackbox 'no_plan';

repeat_each(1);
run_tests();

__DATA__
=== TEST 1: get context reference
get context reference number
--- http_config
lua_package_path "$TEST_NGINX_LUA_PATH";
--- config
location = /t {
content_by_lua_block {
ngx.say(require('resty.ctx').ref())
}
--- configuration
{}
--- upstream
location = /t {
content_by_lua_block {
ngx.say(require('resty.ctx').ref())
}
}
--- upstream_name
ctx
--- more_headers
Host: ctx
--- request
GET /t
--- response_body
Expand All @@ -25,9 +30,9 @@ GET /t
=== TEST 2: stash context reference
--- http_config
lua_package_path "$TEST_NGINX_LUA_PATH";
--- config
--- configuration
{}
--- upstream
set $ctx_ref -1;
location = /t {
Expand All @@ -39,6 +44,10 @@ GET /t
ngx.say(ngx.var.ctx_ref)
}
}
--- upstream_name
ctx
--- more_headers
Host: ctx
--- request
GET /t
--- response_body
Expand All @@ -49,9 +58,9 @@ GET /t
=== TEST 3: apply context reference
--- http_config
lua_package_path "$TEST_NGINX_LUA_PATH";
--- config
--- configuration
{}
--- upstream
set $ctx_ref -1;
location = /t {
Expand All @@ -73,6 +82,10 @@ GET /t
ngx.say(ngx.ctx.foo)
}
}
--- upstream_name
ctx
--- more_headers
Host: ctx
--- request
GET /t
--- response_body
Expand All @@ -83,9 +96,9 @@ bar
=== TEST 4: context is not garbage collected
--- http_config
lua_package_path "$TEST_NGINX_LUA_PATH";
--- config
--- configuration
{}
--- upstream
set $ctx_ref -1;
location = /t {
Expand Down Expand Up @@ -126,6 +139,10 @@ bar
ngx.say(ngx.ctx.foo)
}
}
--- upstream_name
ctx
--- more_headers
Host: ctx
--- request
GET /t
--- response_body
Expand Down

0 comments on commit ec973b7

Please sign in to comment.