mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(elasticache): use the AWS wire codes UserNotFound and UserAlreadyExists (#5452)
* fix(elasticache): use the AWS wire codes UserNotFound and UserAlreadyExists * fix(elasticache): tolerate UserNotFound on CFN user delete and fix SDK test assertions The CloudFormation user delete still tolerated the old UserNotFoundFault code, so deleting a stack whose user was already gone would report DELETE_FAILED. The SDK compatibility test also asserted UserAlreadyExistsException on the duplicate replication group test instead of the duplicate user test.
This commit is contained in:
1 parent
f50437efba
commit
b318794fa2
5 files changed
+24
-12
No files matched your search
+1
-1
@@ -679,7 +679,7 @@ class ElastiCacheCfnProvisionerTest {
|
||||
|
||||
@Test
|
||||
void deleteToleratesAlreadyDeletedButPropagatesOtherFailures() {
|
||||
doThrow(new AwsException("UserNotFoundFault", "gone", 404))
|
||||
doThrow(new AwsException("UserNotFound", "gone", 404))
|
||||
.when(cache).deleteUser("gone");
|
||||
provisioner.delete("AWS::ElastiCache::User", "gone", "us-east-1");
|
||||
|
||||
|
||||
+14
@@ -464,6 +464,20 @@ class ElastiCacheServiceTest {
|
||||
assertEquals(Set.of("valkey-user-id"), service.getUserGroup("vk-group").getUserIds());
|
||||
}
|
||||
|
||||
@Test
|
||||
void userErrorsUseTheBotocoreWireCodesWithoutTheFaultSuffix() {
|
||||
service.createUser("dupe-user", "dupe", AuthMode.PASSWORD, List.of("pw"), "on ~* +@all", "redis");
|
||||
|
||||
AwsException duplicate = assertThrows(AwsException.class, () -> service.createUser(
|
||||
"dupe-user", "dupe", AuthMode.PASSWORD, List.of("pw"), "on ~* +@all", "redis"));
|
||||
assertEquals("UserAlreadyExists", duplicate.getErrorCode());
|
||||
assertEquals(400, duplicate.getHttpStatus());
|
||||
assertEquals("UserNotFound", assertThrows(AwsException.class, () -> service.getUser("absent")).getErrorCode());
|
||||
assertEquals("UserNotFound",
|
||||
assertThrows(AwsException.class, () -> service.listUsers("absent", null)).getErrorCode());
|
||||
assertEquals("UserNotFound", assertThrows(AwsException.class, () -> service.deleteUser("absent")).getErrorCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
void singleArgAuthFallsBackToGroupAuthToken() {
|
||||
service.createReplicationGroup("grp", "test", AuthMode.PASSWORD, "group-token", "us-east-1");
|
||||
|
||||
Reference in new issue
Block a user