-
Notifications
You must be signed in to change notification settings - Fork 35
test: per-directory coverage + E2E cleanup hardening (Days 5-6) #1123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tejaskash
wants to merge
5
commits into
main
Choose a base branch
from
worktree-test-cleanup-day5-7
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
677ab95
test: per-directory coverage thresholds + E2E cleanup hardening
tejaskash 2fffb14
docs: remove test-resource-sweeper-spec
tejaskash 887161c
fix: address review comments on Days 5-6
tejaskash a9c4cf9
style: fix prettier formatting in check-coverage.mjs
tejaskash 9c0156f
test: update snapshot for cdk.ts e2e tag injection
tejaskash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,7 +48,36 @@ const region = process.env.AWS_REGION ?? 'us-east-1'; | |
| * Run the local CLI build without skipping install (needed for deploy). | ||
| */ | ||
| function runLocalCLI(args: string[], cwd: string): Promise<RunResult> { | ||
| return runCLI(args, cwd, { skipInstall: false }); | ||
| return runCLI(args, cwd, { | ||
| skipInstall: false, | ||
| env: { | ||
| AGENTCORE_E2E_TEST: '1', | ||
| AGENTCORE_E2E_CREATOR: process.env.AGENTCORE_E2E_CREATOR ?? 'github-actions', | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| async function deleteCognitoResourceWithRetry( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this function is called Does it make sense to fully generalize it? |
||
| label: string, | ||
| op: () => Promise<unknown>, | ||
| attempts = 3, | ||
| delayMs = 5000 | ||
| ): Promise<void> { | ||
| for (let attempt = 1; attempt <= attempts; attempt++) { | ||
| try { | ||
| await op(); | ||
| return; | ||
| } catch (err) { | ||
| const name = (err as { name?: string }).name ?? 'Unknown'; | ||
| const msg = (err as { message?: string }).message ?? String(err); | ||
| if (attempt === attempts) { | ||
| console.error(`[cognito-cleanup] ${label} failed after ${attempts} attempts: [${name}] ${msg}`); | ||
| return; | ||
| } | ||
| console.warn(`[cognito-cleanup] ${label} attempt ${attempt}/${attempts} failed: [${name}] — retrying`); | ||
| await new Promise(resolve => setTimeout(resolve, delayMs)); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| describe.sequential('e2e: BYO agent with CUSTOM_JWT auth', () => { | ||
|
|
@@ -201,21 +230,15 @@ describe.sequential('e2e: BYO agent with CUSTOM_JWT auth', () => { | |
|
|
||
| // ── Delete Cognito resources ── | ||
| if (userPoolId) { | ||
| try { | ||
| await cognitoClient.send(new DeleteResourceServerCommand({ UserPoolId: userPoolId, Identifier: 'agentcore' })); | ||
| } catch { | ||
| /* best-effort */ | ||
| } | ||
| try { | ||
| await cognitoClient.send(new DeleteUserPoolDomainCommand({ UserPoolId: userPoolId, Domain: domainPrefix })); | ||
| } catch { | ||
| /* best-effort */ | ||
| } | ||
| try { | ||
| await cognitoClient.send(new DeleteUserPoolCommand({ UserPoolId: userPoolId })); | ||
| } catch { | ||
| /* best-effort */ | ||
| } | ||
| await deleteCognitoResourceWithRetry('DeleteResourceServer', () => | ||
| cognitoClient.send(new DeleteResourceServerCommand({ UserPoolId: userPoolId, Identifier: 'agentcore' })) | ||
| ); | ||
| await deleteCognitoResourceWithRetry('DeleteUserPoolDomain', () => | ||
| cognitoClient.send(new DeleteUserPoolDomainCommand({ UserPoolId: userPoolId, Domain: domainPrefix })) | ||
| ); | ||
| await deleteCognitoResourceWithRetry('DeleteUserPool', () => | ||
| cognitoClient.send(new DeleteUserPoolCommand({ UserPoolId: userPoolId })) | ||
| ); | ||
| } | ||
|
|
||
| // ── Clean up temp directory ── | ||
|
|
||
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
nit: does it make sense to consolidate this cleanup into a common util?