mirror of
https://github.com/floci-io/floci.git
synced 2026-11-28 16:11: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
@@ -31,7 +31,9 @@ import software.amazon.awssdk.services.elasticache.model.ModifyReplicationGroupR
|
||||
import software.amazon.awssdk.services.elasticache.model.ModifyUserRequest;
|
||||
import software.amazon.awssdk.services.elasticache.model.ModifyUserResponse;
|
||||
import software.amazon.awssdk.services.elasticache.model.ReplicationGroup;
|
||||
import software.amazon.awssdk.services.elasticache.model.UserAlreadyExistsException;
|
||||
import software.amazon.awssdk.services.elasticache.model.UserGroupNotFoundException;
|
||||
import software.amazon.awssdk.services.elasticache.model.UserNotFoundException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -193,8 +195,6 @@ class ElastiCacheTest {
|
||||
void createDuplicateUserThrows409() {
|
||||
requireUser();
|
||||
|
||||
// Floci returns generic error code, SDK maps to ElastiCacheException
|
||||
// rather than UserAlreadyExistsException (pre-existing deviation)
|
||||
assertThatThrownBy(() -> elasticache.createUser(CreateUserRequest.builder()
|
||||
.userId(userId)
|
||||
.userName(userName)
|
||||
@@ -205,7 +205,7 @@ class ElastiCacheTest {
|
||||
.passwords("user-password-1")
|
||||
.build())
|
||||
.build()))
|
||||
.isInstanceOf(ElastiCacheException.class)
|
||||
.isInstanceOf(UserAlreadyExistsException.class)
|
||||
.hasMessageContaining("already exists");
|
||||
}
|
||||
|
||||
@@ -276,12 +276,10 @@ class ElastiCacheTest {
|
||||
|
||||
elasticache.deleteUser(DeleteUserRequest.builder().userId(userId).build());
|
||||
|
||||
// Floci returns generic error code, SDK maps to ElastiCacheException
|
||||
// rather than UserNotFoundException (pre-existing deviation)
|
||||
assertThatThrownBy(() -> elasticache.describeUsers(DescribeUsersRequest.builder()
|
||||
.userId(userId)
|
||||
.build()))
|
||||
.isInstanceOf(ElastiCacheException.class)
|
||||
.isInstanceOf(UserNotFoundException.class)
|
||||
.hasMessageContaining("not found");
|
||||
userCreated = false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user