(userName)
| 63 | // the cleanup runs whatever state the test left behind, so every |
| 64 | // deletion has to tolerate resources that were never created |
| 65 | async function deleteServiceUser(userName) { |
| 66 | const keys = await ignoreNoSuchEntity( |
| 67 | iamClient.send( |
| 68 | new ListAccessKeysCommand({ |
| 69 | UserName: userName, |
| 70 | MaxItems: 100, |
| 71 | }), |
| 72 | ), |
| 73 | ); |
| 74 | for (const key of keys ? keys.AccessKeyMetadata : []) { |
| 75 | await ignoreNoSuchEntity( |
| 76 | iamClient.send( |
| 77 | new DeleteAccessKeyCommand({ |
| 78 | UserName: userName, |
| 79 | AccessKeyId: key.AccessKeyId, |
| 80 | }), |
| 81 | ), |
| 82 | ); |
| 83 | } |
| 84 | await ignoreNoSuchEntity( |
| 85 | iamClient.send( |
| 86 | new DeleteUserPolicyCommand({ |
| 87 | UserName: userName, |
| 88 | PolicyName: userName, |
| 89 | }), |
| 90 | ), |
| 91 | ); |
| 92 | await ignoreNoSuchEntity( |
| 93 | iamClient.send( |
| 94 | new DeleteUserCommand({ |
| 95 | UserName: userName, |
| 96 | }), |
| 97 | ), |
| 98 | ); |
| 99 | } |
| 100 | |
| 101 | describe('ensureServiceUser script', () => { |
| 102 | let userName; |
no test coverage detected