ci: add support to test all cassettes - #4483
Open
remyleone wants to merge 6 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds a nightly CI validation that scans and loads all recorded VCR cassettes and fails if unexpected HTTP error responses are present.
Changes:
- Introduces a Go test that walks
../namespacesto load cassette files and validate response codes. - Adds a nightly workflow step to run only the cassette validator test.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| internal/testhelpers/cassette_validators_test.go | New test that enumerates cassette files and validates recorded HTTP interactions. |
| .github/workflows/nightly.yml | Runs the new cassette validation test during nightly CI. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+45
to
+53
| err := filepath.WalkDir("../namespaces", func(path string, _ fs.DirEntry, _ error) error { | ||
| isCassette := strings.Contains(path, "cassette") | ||
| _, isException := exceptions[path] | ||
| if isCassette && !isException { | ||
| filesMap[fileNameWithoutExtSuffix(path)] = struct{}{} | ||
| } | ||
|
|
||
| return nil | ||
| }) |
Comment on lines
+44
to
+50
| exceptions := exceptionsCassettesCases() | ||
| err := filepath.WalkDir("../namespaces", func(path string, _ fs.DirEntry, _ error) error { | ||
| isCassette := strings.Contains(path, "cassette") | ||
| _, isException := exceptions[path] | ||
| if isCassette && !isException { | ||
| filesMap[fileNameWithoutExtSuffix(path)] = struct{}{} | ||
| } |
Comment on lines
+133
to
+137
| for path := range paths { | ||
| c, err := cassette.Load(path) | ||
| require.NoError(t, err) | ||
| require.NoError(t, checkErrorCode(c)) | ||
| } |
Comment on lines
+73
to
+75
| - name: Run acceptance test for cassettes | ||
| if: success() || failure() # If the job is not cancelled, run it regardless of the result of the previous step | ||
| run: go test -v github.com/scaleway/scaleway-cli/v2/internal/testhelpers -run TestAccCassettes_Validator |
| } | ||
|
|
||
| // isTransientStateError checks if the interaction response is a transient state error | ||
| // Transient state error are expected when creating resource linked to each other |
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.
Community Note
Relates OR Closes #0000
Release note for CHANGELOG: