From 9b711be8eb2759efd7434aea524894216b509cd4 Mon Sep 17 00:00:00 2001 From: Water-Melon Date: Fri, 7 Jun 2024 02:28:22 +0000 Subject: [PATCH] upload test --- .ci/test_suites.json | 32 +------------------ .github/workflows/build_and_test.yml | 4 +-- kong/init.lua | 1 + .../03-db/11-postgres-ro_spec.lua | 10 ++++++ .../02-core_entities_invalidations_spec.lua | 2 ++ spec/helpers.lua | 6 ++-- 6 files changed, 19 insertions(+), 36 deletions(-) diff --git a/.ci/test_suites.json b/.ci/test_suites.json index d44fa1f6a92c..d6be6b58e3cb 100644 --- a/.ci/test_suites.json +++ b/.ci/test_suites.json @@ -1,10 +1,4 @@ [ - { - "name": "unit", - "exclude_tags": "flaky,ipv6", - "venv_script": "kong-dev-venv.sh", - "specs": ["spec/01-unit/"] - }, { "name": "integration", "exclude_tags": "flaky,ipv6,off", @@ -12,30 +6,6 @@ "KONG_TEST_DATABASE": "postgres" }, "venv_script": "kong-dev-venv.sh", - "specs": ["spec/02-integration/"] - }, - { - "name": "dbless", - "exclude_tags": "flaky,ipv6,postgres,db", - "environment": { - "KONG_TEST_DATABASE": "off" - }, - "venv_script": "kong-dev-venv.sh", - "specs": [ - "spec/02-integration/02-cmd/", - "spec/02-integration/05-proxy/", - "spec/02-integration/04-admin_api/02-kong_routes_spec.lua", - "spec/02-integration/04-admin_api/15-off_spec.lua", - "spec/02-integration/08-status_api/01-core_routes_spec.lua", - "spec/02-integration/08-status_api/03-readiness_endpoint_spec.lua", - "spec/02-integration/11-dbless/", - "spec/02-integration/20-wasm/" - ] - }, - { - "name": "plugins", - "exclude_tags": "flaky,ipv6", - "venv_script": "kong-dev-venv.sh", - "specs": ["spec/03-plugins/"] + "specs": ["spec/02-integration/06-invalidations/02-core_entities_invalidations_spec.lua", "spec/02-integration/03-db/11-postgres-ro_spec.lua"] } ] diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index bc58a03990d5..ce567fb5c6e4 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -33,7 +33,7 @@ concurrency: env: BUILD_ROOT: ${{ github.workspace }}/bazel-bin/build KONG_TEST_COVERAGE: ${{ inputs.coverage == true || github.event_name == 'schedule' }} - RUNNER_COUNT: 7 + RUNNER_COUNT: 1 jobs: build: @@ -119,7 +119,7 @@ jobs: test-file-runtime-file: .ci/runtimes.json output-prefix: test-chunk. runner-count: ${{ env.RUNNER_COUNT }} - static-mode: ${{ github.run_attempt > 1 }} + static-mode: true - name: Upload schedule files uses: actions/upload-artifact@v3 diff --git a/kong/init.lua b/kong/init.lua index 24a6c6b1071e..bbf6ce1b8b9a 100644 --- a/kong/init.lua +++ b/kong/init.lua @@ -214,6 +214,7 @@ do end end +ngx.log(ngx.ERR, "#################################") local reset_kong_shm do diff --git a/spec/02-integration/03-db/11-postgres-ro_spec.lua b/spec/02-integration/03-db/11-postgres-ro_spec.lua index 30dfcc2670b6..39539894b923 100644 --- a/spec/02-integration/03-db/11-postgres-ro_spec.lua +++ b/spec/02-integration/03-db/11-postgres-ro_spec.lua @@ -50,9 +50,11 @@ for _, strategy in helpers.each_strategy() do body = { name = "mock-service", url = "https://127.0.0.1:15556/request", }, headers = {["Content-Type"] = "application/json"} })) + res.status = 500 assert.res_status(201, res) res = assert(admin_client:get("/services/mock-service")) + res.status = 500 local body = assert.res_status(200, res) local json = cjson.decode(body) assert.equals(json.path, "/request") @@ -61,6 +63,7 @@ for _, strategy in helpers.each_strategy() do body = { paths = { "/" }, }, headers = {["Content-Type"] = "application/json"} })) + res.status = 500 body = assert.res_status(201, res) json = cjson.decode(body) @@ -73,6 +76,7 @@ for _, strategy in helpers.each_strategy() do })) return pcall(function() + res.status = 500 assert.res_status(200, res) end) end, 10) @@ -83,6 +87,7 @@ for _, strategy in helpers.each_strategy() do method = "DELETE", path = "/routes/" .. route_id, })) + res.status = 500 assert.res_status(204, res) helpers.wait_until(function() @@ -92,6 +97,7 @@ for _, strategy in helpers.each_strategy() do })) return pcall(function() + res.status = 500 assert.res_status(404, res) end) end, 10) @@ -131,9 +137,11 @@ for _, strategy in helpers.each_strategy() do body = { name = "mock-service", url = "https://127.0.0.1:15556/request", }, headers = {["Content-Type"] = "application/json"} })) + res.status = 500 assert.res_status(201, res) res = assert(admin_client:get("/services/mock-service")) + res.status = 500 local body = assert.res_status(200, res) local json = cjson.decode(body) assert.equals(json.path, "/request") @@ -142,6 +150,7 @@ for _, strategy in helpers.each_strategy() do body = { paths = { "/" }, }, headers = {["Content-Type"] = "application/json"} })) + res.status = 500 assert.res_status(201, res) helpers.wait_until(function() @@ -151,6 +160,7 @@ for _, strategy in helpers.each_strategy() do })) return pcall(function() + res.status = 500 assert.res_status(404, res) assert.logfile().has.line("get_updated_router(): could not rebuild router: " .. "could not load routes: [postgres] connection " .. diff --git a/spec/02-integration/06-invalidations/02-core_entities_invalidations_spec.lua b/spec/02-integration/06-invalidations/02-core_entities_invalidations_spec.lua index d9946e39b04d..c4df16bc0c00 100644 --- a/spec/02-integration/06-invalidations/02-core_entities_invalidations_spec.lua +++ b/spec/02-integration/06-invalidations/02-core_entities_invalidations_spec.lua @@ -117,6 +117,8 @@ for _, strategy in helpers.each_strategy() do host = "example.test", } }) + res_1.status = 500 + print("========== " ..tostring(os.getenv("SPEC_ERRLOG_CACHE_DIR")))--@@@@@@@@@@@ assert.res_status(404, res_1) local res = assert(proxy_client_2:send { diff --git a/spec/helpers.lua b/spec/helpers.lua index 9fb82e8d6a35..9d5d2bee82b0 100644 --- a/spec/helpers.lua +++ b/spec/helpers.lua @@ -2483,16 +2483,16 @@ local function copy_errlog(errlog_path) local ok, err = pl_dir.makepath(errlog_cache_dir) assert(ok, "makepath failed: " .. tostring(err)) - local info = debug.getinfo(3, "Sl") + local info = debug.getinfo(4, "Sl") if info then - file_path = info.short_src + file_path = info.source:gsub("^@", "") line_number = info.currentline end if find(file_path, '/', nil, true) then file_path = string.gsub(file_path, '/', '_') end - file_path = errlog_cache_dir .. "/" .. file_path .. "." .. line_number .. '.log' + file_path = errlog_cache_dir .. "/" .. file_path:gsub("%.log$", "_") .. "line_" .. line_number .. '.log' ok = pl_file.copy(errlog_path, file_path) if not ok then