mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
fix(rds): apply IAM auth toggles to running proxies (#3668)
Signed-off-by: 7487 <1042653432@qq.com>
This commit is contained in:
1 parent
2ee3aa67c0
commit
e1e98fd8dc
5 files changed
+43
-9
No files matched your search
+20
-8
@@ -2,7 +2,6 @@ package com.floci.test;
|
||||
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -191,15 +190,10 @@ class RdsJdbcCompatTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Disabled("modifyDbInstance does not propagate iamEnabled to running proxy (RdsAuthProxy.iamEnabled is final)")
|
||||
@Test
|
||||
@Order(5)
|
||||
@DisplayName("Enable IAM via modify on instance created without IAM")
|
||||
void enableIamViaModifyAndConnect() throws Exception {
|
||||
// This test documents the expected toggle behavior: create without IAM,
|
||||
// verify rejection, enable via modify, verify acceptance. Currently blocked
|
||||
// because RdsAuthProxy captures iamEnabled at startup and ModifyDBInstance
|
||||
// does not restart the proxy.
|
||||
@DisplayName("Toggle IAM via modify on a running instance")
|
||||
void toggleIamViaModifyOnRunningInstance() throws Exception {
|
||||
assumeInstanceCreated();
|
||||
|
||||
String toggleId = TestFixtures.uniqueName("rds-toggle");
|
||||
@@ -233,6 +227,7 @@ class RdsJdbcCompatTest {
|
||||
rds.modifyDBInstance(ModifyDbInstanceRequest.builder()
|
||||
.dbInstanceIdentifier(toggleId)
|
||||
.enableIAMDatabaseAuthentication(true)
|
||||
.applyImmediately(true)
|
||||
.build());
|
||||
|
||||
// Should accept IAM after enable
|
||||
@@ -250,6 +245,23 @@ class RdsJdbcCompatTest {
|
||||
} finally {
|
||||
connection.close();
|
||||
}
|
||||
|
||||
rds.modifyDBInstance(ModifyDbInstanceRequest.builder()
|
||||
.dbInstanceIdentifier(toggleId)
|
||||
.enableIAMDatabaseAuthentication(false)
|
||||
.applyImmediately(true)
|
||||
.build());
|
||||
|
||||
String token3 = rds.utilities().generateAuthenticationToken(GenerateAuthenticationTokenRequest.builder()
|
||||
.hostname(TestFixtures.proxyHost())
|
||||
.port(togglePort)
|
||||
.username(USERNAME)
|
||||
.region(REGION)
|
||||
.credentialsProvider(CREDENTIALS)
|
||||
.build());
|
||||
|
||||
assertThatThrownBy(() -> openPostgresConnection(USERNAME, token3, togglePort))
|
||||
.isInstanceOf(SQLException.class);
|
||||
} finally {
|
||||
try {
|
||||
rds.deleteDBInstance(DeleteDbInstanceRequest.builder()
|
||||
|
||||
Reference in new issue
Block a user