Skip to content

Commit

Permalink
upload test
Browse files Browse the repository at this point in the history
  • Loading branch information
Water-Melon committed Jun 7, 2024
1 parent e375f2d commit 9b711be
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 36 deletions.
32 changes: 1 addition & 31 deletions .ci/test_suites.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,11 @@
[
{
"name": "unit",
"exclude_tags": "flaky,ipv6",
"venv_script": "kong-dev-venv.sh",
"specs": ["spec/01-unit/"]
},
{
"name": "integration",
"exclude_tags": "flaky,ipv6,off",
"environment": {
"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"]
}
]
4 changes: 2 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions kong/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ do
end
end

ngx.log(ngx.ERR, "#################################")

local reset_kong_shm
do
Expand Down
10 changes: 10 additions & 0 deletions spec/02-integration/03-db/11-postgres-ro_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)

Expand All @@ -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)
Expand All @@ -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()
Expand All @@ -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)
Expand Down Expand Up @@ -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")
Expand All @@ -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()
Expand All @@ -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 " ..
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions spec/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9b711be

Please sign in to comment.