chore: add resilience-test suite and remove individual test#6807
chore: add resilience-test suite and remove individual test#6807PeterSchafer wants to merge 1 commit into
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
PR Reviewer Guide 🔍
|
| ['sbomTestReachability', false], | ||
| ['useTestShimForOSCliTest', false], | ||
| ['cliDotnetRuntimeResolution', false], | ||
| ['isSecretsEnabled', true], |
There was a problem hiding this comment.
Maybe we want to enable this only in the tests, to avoid doing this globally.
| // Scenario 3 | ||
| { | ||
| name: 'unauthorized-401', | ||
| description: 'Backend returns 401 Unauthorized', |
There was a problem hiding this comment.
Nice addition, maybe worth adding to the PR description as well. Scenario 4 too.
nit: Also suggest changing the PR title to chore: unify resilience tests and add 401/mid-execution-maintenance scenarios
| it('does not attempt any retries', async () => { | ||
| await runSnykCLI(`test -d --log-level=trace`, { | ||
| env: { | ||
| ...env, | ||
| // apply a user configured attempts of 10 | ||
| INTERNAL_NETWORK_REQUEST_MAX_ATTEMPTS: '10', | ||
| }, | ||
| }); | ||
|
|
||
| // Count how many times an endpoint was hit | ||
| const requests = server.getRequests(); | ||
| const actualNetworkAttempts = requests.filter( | ||
| (r) => r.url.includes('/test-dep-graph') || r.url.includes('/vuln/'), | ||
| ).length; | ||
|
|
||
| expect(actualNetworkAttempts).toBe(1); | ||
| }); |
There was a problem hiding this comment.
hmm I think this test is missing in the new file?
There was a problem hiding this comment.
I am not fully sure why: the PR description mentions "remove individual test" but the backing ticket does not mention any of that
| INTERNAL_NETWORK_REQUEST_MAX_ATTEMPTS: '1', | ||
| INTERNAL_NETWORK_REQUEST_RETRY_AFTER_SECONDS: '1', |
There was a problem hiding this comment.
Also these two are not present in the new file
| envOverrides: { | ||
| SNYK_TIMEOUT_SECS: String(TIMEOUT_SECS), | ||
| }, | ||
| skip: ['container sbom scratch'], |
There was a problem hiding this comment.
hmmm do we want to skip this here?
| // Should send instrumentation data even on timeout | ||
| const requests = server.getRequests(); | ||
| const instrumentationRequest = requests.find((r) => | ||
| r.url?.includes(`/api/hidden/orgs/${orgId}/analytics`), | ||
| ); | ||
| expect(instrumentationRequest).toBeDefined(); |
There was a problem hiding this comment.
I guess this is also absent in the new file
| beforeEach(async () => { | ||
| initialConfig = await getCliConfig(); | ||
| // Set server to delay responses longer than the timeout (10s > 5s timeout) | ||
| server.setResponseDelay(SERVER_DELAY_MS); | ||
| }); |
There was a problem hiding this comment.
We don't have beforeEach in the new file, is that intentional?
| 'monitor', | ||
| 'whoami', | ||
| 'auth 11111111-2222-3333-4444-555555555555', | ||
| 'sbom --org=11111111-1111-1111-1111-111111111111 --format=cyclonedx1.4+json', |
There was a problem hiding this comment.
Before it was:
sbom --org=test-org --format=cyclonedx1.4+json
Any reason for changing the org here?
There was a problem hiding this comment.
I think this is just about aligning the test with baseEnv defined in lines 195-201
Pull Request Submission Checklist
are release-note ready, emphasizing
what was changed, not how.
What does this PR do?
This PR moves existing separate tests into a single test suite for easier overview and maintenance.
Where should the reviewer start?
How should this be manually tested?
What's the product update that needs to be communicated to CLI users?
N/A
Risk assessment (Low | Medium | High)?
Low, changes tests only