diff --git a/ci/utils/linux-common-runnner.sh b/ci/utils/linux-common-runnner.sh index 4e6a75e..1c7eae2 100755 --- a/ci/utils/linux-common-runnner.sh +++ b/ci/utils/linux-common-runnner.sh @@ -19,7 +19,7 @@ export_or_prefix() { get_apisix_code() { # ${1} branch name # ${2} checkout path - git_branch=${1:-release/2.12} + git_branch=${1:-release/2.15} git_checkout_path=${2:-workbench} git clone --depth 1 --recursive https://github.com/apache/apisix.git \ -b "${git_branch}" "${git_checkout_path}" && cd "${git_checkout_path}" || exit 1 diff --git a/t/demo/demo.t b/t/demo/demo.t index 55bd01d..aa417ab 100644 --- a/t/demo/demo.t +++ b/t/demo/demo.t @@ -11,6 +11,7 @@ add_block_preprocessor(sub { my $extra_yaml_config = $block->extra_yaml_config // <<_EOC_; plugins: - demo + - public-api _EOC_ $block->set_value("extra_yaml_config", $extra_yaml_config); @@ -46,33 +47,45 @@ hello, world! --- config location = /t { content_by_lua_block { - local t = require("lib.test_admin").test - local code, body = t('/apisix/admin/routes/1', - ngx.HTTP_PUT, - [[{ - "plugins": { - "demo": { - "body": "test" - } - }, - "upstream": { - "nodes": { - "127.0.0.1:1980": 1 + local data = { + { + url = "/apisix/admin/routes/1", + data = [[{ + "plugins": { + "demo": { + "body": "test" + } + }, + "upstream": { + "nodes": { + "127.0.0.1:1980": 1 + }, + "type": "roundrobin" }, - "type": "roundrobin" - }, - "uri": "/demo" - }]] - ) - - if code >= 300 then - ngx.status = code + "uri": "/demo" + }]], + }, + { + url = "/apisix/admin/routes/r1", + data = [[{ + "plugins": { + "public-api": {} + }, + "uri": "/apisix/plugin/demo/public_api" + }]] + }, + } + + local t = require("lib.test_admin").test + + for _, data in ipairs(data) do + local code, body = t(data.url, ngx.HTTP_PUT, data.data) + ngx.say(code..body) end - ngx.say(body) } } ---- response_body -passed +--- response_body eval +"201passed\n" x 2