diff --git a/.ci/test_suites.json b/.ci/test_suites.json index eb6b15e5909e..3a15dd205c5b 100644 --- a/.ci/test_suites.json +++ b/.ci/test_suites.json @@ -2,6 +2,7 @@ { "name": "unit", "exclude_tags": "flaky,ipv6", + "venv_script": "kong-dev-venv.sh", "specs": ["spec/01-unit/"] }, { @@ -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/", @@ -29,6 +32,7 @@ { "name": "plugins", "exclude_tags": "flaky,ipv6", + "venv_script": "kong-dev-venv.sh", "specs": ["spec/03-plugins/"] } ] diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 1aa7fc23a580..210d7a3b61b6 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -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 @@ -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 @@ -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() @@ -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 diff --git a/.github/workflows/update-test-runtime-statistics.yml b/.github/workflows/update-test-runtime-statistics.yml index 43e4017a518a..928718a5cd11 100644 --- a/.github/workflows/update-test-runtime-statistics.yml +++ b/.github/workflows/update-test-runtime-statistics.yml @@ -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: diff --git a/Makefile b/Makefile index af0ff49c7996..abeac75ec637 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/spec/busted-ci-helper.lua b/spec/busted-ci-helper.lua index a28b2f367eff..699d894dfa22 100644 --- a/spec/busted-ci-helper.lua +++ b/spec/busted-ci-helper.lua @@ -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 @@ -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