-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): only re-run failed tests (#11925)
* fix(tests): only run failed tests when rerunning * fix(ci): when all tests pass, create empty 'failed' file * fix(ci): scope 'failed tests file' artifact to current workflow run * fix(tests): remove test batch balancing
- Loading branch information
1 parent
c75c7e0
commit 67970ea
Showing
3 changed files
with
87 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
-- busted-log-failed.lua | ||
|
||
-- Log which test files run by busted had failures or errors in a | ||
-- file. The file to use for logging is specified in the | ||
-- FAILED_TEST_FILES_FILE environment variable. This is used to | ||
-- reduce test rerun times for flaky tests. | ||
|
||
local busted = require 'busted' | ||
local failed_files_file = assert(os.getenv("FAILED_TEST_FILES_FILE"), | ||
"FAILED_TEST_FILES_FILE environment variable not set") | ||
|
||
local FAILED_FILES = {} | ||
|
||
busted.subscribe({ 'failure' }, function(element, parent, message, debug) | ||
FAILED_FILES[element.trace.source] = true | ||
end) | ||
|
||
busted.subscribe({ 'error' }, function(element, parent, message, debug) | ||
FAILED_FILES[element.trace.source] = true | ||
end) | ||
|
||
busted.subscribe({ 'suite', 'end' }, function(suite, count, total) | ||
local output = assert(io.open(failed_files_file, "w")) | ||
if next(FAILED_FILES) then | ||
for failed_file in pairs(FAILED_FILES) do | ||
if failed_file:sub(1, 1) == '@' then | ||
failed_file = failed_file:sub(2) | ||
end | ||
assert(output:write(failed_file .. "\n")) | ||
end | ||
end | ||
output:close() | ||
end) |
67970ea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bazel Build
Docker image available
kong/kong:67970ea2b03a8b1538c76b1ede0ace05bff294bf
Artifacts available https://github.com/Kong/kong/actions/runs/6927567512