mirror of
https://github.com/floci-io/floci.git
synced 2026-11-28 08:09:43 -05:00
fix(elasticache): honor SecurityGroupIds on ModifyReplicationGroup (#6467)
* fix(elasticache): honor SecurityGroupIds on ModifyReplicationGroup A modify that names SecurityGroupIds now replaces the whole stored list on the replication group, so DescribeCacheClusters reports the new groups on every member with Status=active; a modify that names none leaves the memberships untouched, which the Query protocol cannot distinguish from an empty list anyway. Closes #6463 Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com> * fix(elasticache): read the modify security groups through the shared parse optionalSecurityGroupIds walked the two Query spellings a second time; it now reuses parseSecurityGroupIds with the same isEmpty-to-null check the user group lists use, and the new compatibility test declares its responses with explicit types. Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com> --------- Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
This commit is contained in:
1 parent
796f203b76
commit
f4cd3110e7
7 files changed
+154
-13
No files matched your search
@@ -18,7 +18,10 @@ import software.amazon.awssdk.services.elasticache.model.CreateUserResponse;
|
||||
import software.amazon.awssdk.services.elasticache.model.DeleteReplicationGroupRequest;
|
||||
import software.amazon.awssdk.services.elasticache.model.DeleteUserGroupRequest;
|
||||
import software.amazon.awssdk.services.elasticache.model.DeleteUserRequest;
|
||||
import software.amazon.awssdk.services.elasticache.model.DescribeCacheClustersRequest;
|
||||
import software.amazon.awssdk.services.elasticache.model.DescribeCacheClustersResponse;
|
||||
import software.amazon.awssdk.services.elasticache.model.DescribeReplicationGroupsRequest;
|
||||
import software.amazon.awssdk.services.elasticache.model.DescribeReplicationGroupsResponse;
|
||||
import software.amazon.awssdk.services.elasticache.model.DescribeUserGroupsRequest;
|
||||
import software.amazon.awssdk.services.elasticache.model.DescribeUserGroupsResponse;
|
||||
import software.amazon.awssdk.services.elasticache.model.DescribeUsersRequest;
|
||||
@@ -31,6 +34,7 @@ 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.SecurityGroupMembership;
|
||||
import software.amazon.awssdk.services.elasticache.model.UserAlreadyExistsException;
|
||||
import software.amazon.awssdk.services.elasticache.model.UserGroupNotFoundException;
|
||||
import software.amazon.awssdk.services.elasticache.model.UserNotFoundException;
|
||||
@@ -410,6 +414,32 @@ class ElastiCacheTest {
|
||||
|
||||
@Test
|
||||
@Order(14)
|
||||
void modifyReplicationGroupSecurityGroupsAreEchoedByMemberClusters() {
|
||||
requireGroup();
|
||||
|
||||
elasticache.modifyReplicationGroup(ModifyReplicationGroupRequest.builder()
|
||||
.replicationGroupId(groupId)
|
||||
.securityGroupIds("sg-compat-1", "sg-compat-2")
|
||||
.build());
|
||||
|
||||
DescribeReplicationGroupsResponse described = elasticache.describeReplicationGroups(
|
||||
DescribeReplicationGroupsRequest.builder()
|
||||
.replicationGroupId(groupId)
|
||||
.build());
|
||||
assertThat(described.replicationGroups().get(0).memberClusters()).hasSize(1);
|
||||
|
||||
DescribeCacheClustersResponse clusters = elasticache.describeCacheClusters(DescribeCacheClustersRequest.builder()
|
||||
.cacheClusterId(described.replicationGroups().get(0).memberClusters().get(0))
|
||||
.build());
|
||||
assertThat(clusters.cacheClusters().get(0).securityGroups())
|
||||
.extracting(SecurityGroupMembership::securityGroupId)
|
||||
.containsExactly("sg-compat-1", "sg-compat-2");
|
||||
assertThat(clusters.cacheClusters().get(0).securityGroups())
|
||||
.allSatisfy(membership -> assertThat(membership.status()).isEqualTo("active"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(15)
|
||||
void deleteReplicationGroupReleasesPortForReuse() {
|
||||
requireGroup();
|
||||
|
||||
|
||||
Reference in new issue
Block a user