test: expired credentials, credential_process
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
For cases like #2664 we can create a fake `credential_process` which returns something like:
```
{
"Version": 1,
"AccessKeyId": "...",
"SecretAccessKey": "...",
"SessionToken": "...",
"Expiration": "2022-06-21T10:22:35Z"
}
```
then later it returns an expired date.
## AC
1. write a test that checks that `recordAwsRefreshCredentials` metric is emitted after...
1. the `credential_process` returns an expired token. https://github.com/aws/aws-toolkit-vscode/blob/master/src/credentials/loginManager.ts#L341
2. the static credentials file is updated externally with new auth material #1226
3. the SSO provider flags the credentials as expired
4. an SDK client request fails with a "invalid token" error
1. the test must setup a real ~/.aws/credentials file on the filesystem so that real codepaths of the Toolkit + SDK are exercised
- the hope is that this will add confidence when we fully migrate to SDK v2 => v3
Contributor guide
Research direction
Read src/credentials/loginManager.ts around line 341, then trace the credential_process refresh path and the related static-file, SSO, and SDK request cases. Set up a real ~/.aws/credentials file and add coverage for recordAwsRefreshCredentials after each expired-credential scenario; done means the metric is emitted for all four cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- authentication, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100