feat(e2e): add JSON file support for extra test cases#727
Draft
mdryaan wants to merge 1 commit into
Draft
Conversation
Fixes: urunc-dev#123 Signed-off-by: Md Raiyan <alikhurshid842001@gmail.com>
✅ Deploy Preview for urunc canceled.
|
Contributor
Author
|
Implementation JSON test cases work for nerdctl and ctr via the foreground path. Docker and crictl are excluded for now since their runners call TestFunc directly and a nil value would panic, Happy to extend those in a follow up if needed. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a JSON loading layer to the e2e test suite so operators can inject additional foreground test cases into
nerdctlTestCases()andctrTestCases()by editing JSON files undertests/e2e/testdata/without modifying Go source.JSON-defined cases always use
runForegroundTest(output matching viaExpectOut) sinceTestFuncis a functionpointer that cannot be serialized to JSON. Docker and crictl are excluded because their test runners call
tc.TestFunc(tool)directly and would panic on a nilTestFunc— those can be extended in a follow-up once a function registry or similar mechanism is added.New files:
tests/e2e/json_test_cases.go—jsonTestCasestruct,loadTestCasesFromJSON,optionalJSONTestCasestests/e2e/json_test_cases_test.go— unit teststests/e2e/testdata/nerdctl_extra_test_cases.json— empty by defaulttests/e2e/testdata/ctr_extra_test_cases.json— empty by defaultModified:
tests/e2e/test_cases.go—nerdctlTestCases()andctrTestCases()now appendoptionalJSONTestCases(...)Related issues
How was this tested?
Added
TestLoadTestCasesFromJSON(6 subtests) andTestOptionalJSONTestCases(3 subtests) intests/e2e/json_test_cases_test.go. All 9 subtests pass: go test -count=1 -timeout 20m ./tests/e2e/... -v -run "TestLoadTestCasesFromJSON|TestOptionalJSONTestCases" Linter passes (golangci-lint run, 0 issues). Build passes (make).LLM usage
N/A
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).