Skip to content

Commit

Permalink
chore(ci): bump scheduler + consistency with EE
Browse files Browse the repository at this point in the history
* bump test scheduler to v3
* apply changes required by v3: pass `xml-output-file` and
  `setup-venv-path` params to runner
* update busted ci helper to be consistent with EE
* reintroduce debug steps in build and test workflow
  • Loading branch information
samugi committed Feb 14, 2024
1 parent da61296 commit 7c29cec
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .ci/test_suites.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
"name": "unit",
"exclude_tags": "flaky,ipv6",
"venv_script": "kong-dev-venv.sh",
"specs": ["spec/01-unit/"]
},
{
Expand All @@ -10,11 +11,13 @@
"environment": {
"KONG_TEST_DATABASE": "postgres"
},
"venv_script": "kong-dev-venv.sh",
"specs": ["spec/02-integration/"]
},
{
"name": "dbless",
"exclude_tags": "flaky,ipv6,postgres,db",
"venv_script": "kong-dev-venv.sh",
"specs": [
"spec/02-integration/02-cmd/",
"spec/02-integration/05-proxy/",
Expand All @@ -29,6 +32,7 @@
{
"name": "plugins",
"exclude_tags": "flaky,ipv6",
"venv_script": "kong-dev-venv.sh",
"specs": ["spec/03-plugins/"]
}
]
30 changes: 27 additions & 3 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@ jobs:
repo-path: Kong/gateway-action-storage/main/.ci/runtimes.json

- name: Schedule tests
uses: Kong/gateway-test-scheduler/schedule@b91bd7aec42bd13748652929f087be81d1d40843 # v1
uses: Kong/gateway-test-scheduler/schedule@69f0c2a562ac44fc3650b8bfa62106b34094b5ce # v3
with:
test-suites-file: .ci/test_suites.json
test-file-runtime-file: .ci/runtimes.json
output-prefix: test-chunk.
runner-count: ${{ env.RUNNER_COUNT }}
static-mode: ${{ github.run_attempt > 1 }}

- name: Upload schedule files
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -225,6 +226,24 @@ jobs:
unzip -o /tmp/aws-sam-cli.zip -d /tmp/aws-sam-cli
sudo /tmp/aws-sam-cli/install --update
- name: Update PATH
run: |
echo "$BUILD_ROOT/kong-dev/bin" >> $GITHUB_PATH
echo "$BUILD_ROOT/kong-dev/openresty/nginx/sbin" >> $GITHUB_PATH
echo "$BUILD_ROOT/kong-dev/openresty/bin" >> $GITHUB_PATH
- name: Debug (nginx)
run: |
echo nginx: $(which nginx)
nginx -V 2>&1 | sed -re 's/ --/\n--/g'
ldd $(which nginx)
- name: Debug (luarocks)
run: |
echo luarocks: $(which luarocks)
luarocks --version
luarocks config
- name: Create kong_ro user in Postgres
run: |
psql -v ON_ERROR_STOP=1 -h localhost --username kong <<\EOD
Expand Down Expand Up @@ -280,12 +299,12 @@ jobs:
DD_CIVISIBILITY_AGENTLESS_ENABLED: true
DD_TRACE_GIT_METADATA_ENABLED: true
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
uses: Kong/gateway-test-scheduler/runner@b91bd7aec42bd13748652929f087be81d1d40843 # v1
uses: Kong/gateway-test-scheduler/runner@69f0c2a562ac44fc3650b8bfa62106b34094b5ce # v3
with:
tests-to-run-file: test-chunk.${{ matrix.runner }}.json
failed-test-files-file: ${{ env.FAILED_TEST_FILES_FILE }}
test-file-runtime-file: ${{ env.TEST_FILE_RUNTIME_FILE }}
setup-venv: . ${{ env.BUILD_ROOT }}/kong-dev-venv.sh
setup-venv-path: ${{ env.BUILD_ROOT }}

- name: Upload test rerun information
if: always()
Expand All @@ -312,6 +331,11 @@ jobs:
path: |
luacov.stats.out
- name: Get kernel message
if: failure()
run: |
sudo dmesg -T
pdk-tests:
name: PDK tests
runs-on: ubuntu-22.04
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-test-runtime-statistics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
token: ${{ secrets.PAT }}

- name: Process statistics
uses: Kong/gateway-test-scheduler/analyze@b91bd7aec42bd13748652929f087be81d1d40843 # v1
uses: Kong/gateway-test-scheduler/analyze@69f0c2a562ac44fc3650b8bfa62106b34094b5ce # v3
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OS := $(shell uname | awk '{print tolower($$0)}')
MACHINE := $(shell uname -m)

DEV_ROCKS = "busted 2.2.0" "busted-htest 1.0.0" "luacheck 1.1.2" "lua-llthreads2 0.1.6" "ldoc 1.5.0" "luacov 0.15.0"
DEV_ROCKS = "busted 2.2.0" "busted-hjtest 0.0.5" "luacheck 1.1.2" "lua-llthreads2 0.1.6" "ldoc 1.5.0" "luacov 0.15.0"
WIN_SCRIPTS = "bin/busted" "bin/kong" "bin/kong-health"
BUSTED_ARGS ?= -v
TEST_CMD ?= bin/busted $(BUSTED_ARGS)
Expand Down
18 changes: 15 additions & 3 deletions spec/busted-ci-helper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,22 @@ local socket_unix = require 'socket.unix'
local busted_event_path = os.getenv("BUSTED_EVENT_PATH")

-- Function to recursively copy a table, skipping keys associated with functions
local function copyTable(original, copied)
copied = copied or {}
local function copyTable(original, copied, cache, max_depth, current_depth)
copied = copied or {}
cache = cache or {}
max_depth = max_depth or 5
current_depth = current_depth or 1

if cache[original] then return cache[original] end
cache[original] = copied

for key, value in pairs(original) do
if type(value) == "table" then
copied[key] = copyTable(value, {})
if current_depth < max_depth then
copied[key] = copyTable(value, {}, cache, max_depth, current_depth + 1)
end
elseif type(value) == "userdata" then
copied[key] = tostring(value)
elseif type(value) ~= "function" then
copied[key] = value
end
Expand Down Expand Up @@ -43,6 +53,8 @@ if busted_event_path then
for i, original in ipairs{...} do
if type(original) == "table" then
args[i] = copyTable(original)
elseif type(original) == "userdata" then
args[i] = tostring(original)
elseif type(original) ~= "function" then
args[i] = original
end
Expand Down

0 comments on commit 7c29cec

Please sign in to comment.