File tree Expand file tree Collapse file tree 7 files changed +377
-208
lines changed
Expand file tree Collapse file tree 7 files changed +377
-208
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 2525
2626class DialectAuroraMySql : virtual public Dialect {
2727public:
28- int GetDefaultPort () override { return DEFAULT_POSTGRES_PORT ; };
28+ int GetDefaultPort () override { return DEFAULT_MYSQL_PORT ; };
2929 std::string GetTopologyQuery () override { return TOPOLOGY_QUERY; };
3030 std::string GetWriterIdQuery () override { return WRITER_ID_QUERY; };
3131 std::string GetNodeIdQuery () override { return NODE_ID_QUERY; };
@@ -46,7 +46,7 @@ class DialectAuroraMySql : virtual public Dialect {
4646 };
4747
4848private:
49- const int DEFAULT_POSTGRES_PORT = 3306 ;
49+ const int DEFAULT_MYSQL_PORT = 3306 ;
5050 const std::string TOPOLOGY_QUERY =
5151 " SELECT SERVER_ID, CASE WHEN SESSION_ID = 'MASTER_SESSION_ID' THEN TRUE ELSE FALSE END, \
5252 CPU, REPLICA_LAG_IN_MILLISECONDS, LAST_UPDATE_TIMESTAMP \
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ function add_ip_to_db_sg {
4242 cidrBlock=" $LocalIp /32"
4343
4444 # Allow inbound traffic from the local IP address to the DB security group using AWS CLI
45- aws ec2 authorize-security-group-ingress --group-id $securityGroupId --protocol tcp --cidr $cidrBlock --port 5432 --region $Region || true
45+ aws ec2 authorize-security-group-ingress --group-id $securityGroupId --protocol tcp --cidr $cidrBlock --port 0-65535 --region $Region || true
4646
4747 # Sleep to ensure IP is added and propagated to DBs before moving onto next step
4848 sleep 60
@@ -76,7 +76,7 @@ function remove_ip_from_db_sg {
7676 cidrBlock=" $LocalIp /32"
7777
7878 # Revoke Inbound traffic
79- aws ec2 revoke-security-group-ingress --group-id $securityGroupId --protocol tcp --cidr $cidrBlock --port 5432 --region $Region || true
79+ aws ec2 revoke-security-group-ingress --group-id $securityGroupId --protocol tcp --cidr $cidrBlock --port 0-65565 --region $Region || true
8080
8181 # Check if revoked successfully
8282 if [ $? -eq 0 ]; then
Original file line number Diff line number Diff line change @@ -226,7 +226,7 @@ function Add-Ip-To-Db-Sg {
226226 $cidrBlock = " $localIp /32"
227227
228228 # Allow inbound traffic from the local IP address to the DB security group using AWS CLI
229- $authorizeResult = aws ec2 authorize- security- group-ingress -- group-id $securityGroupId -- protocol tcp -- cidr $cidrBlock -- port 5432 -- region $Region
229+ $authorizeResult = aws ec2 authorize- security- group-ingress -- group-id $securityGroupId -- protocol tcp -- cidr $cidrBlock -- port 0 - 65535 -- region $Region
230230
231231 # Check if the ingress rule was successfully added
232232 if ($? ) {
Original file line number Diff line number Diff line change @@ -157,20 +157,17 @@ ENDIF()
157157# ODBC Unix DSN ---------------------------------------------------------------------------------------------
158158SET (ODBC_PATH ${CMAKE_CURRENT_SOURCE_DIR} /../resources/)
159159
160- # Common Settings
160+ # DSN Settings
161161SET (THREADING "0" )
162- SET (TEST_SERVER ${TEST_SERVER} ,${TEST_PORT} )
163- SET (TEST_DATABASE ${TEST_DATABASE} )
164-
165- # Test Driver
166- SET (TEST_DSN ${TEST_DSN} )
167- SET (TEST_DRIVER_NAME "aws-odbc-wrapper" )
168- SET (TEST_DRIVER_PATH ${TEST_DRIVER_PATH} )
169-
170- # Base PG Driver
171- SET (BASE_PG_DSN "pg-dsn" )
172- SET (BASE_PG_DRIVER_NAME "community-pg" )
173- SET (BASE_PG_DRIVER_PATH ${BASE_PG_DRIVER_PATH} )
162+
163+ # To be set via flags
164+ # -D TEST_DRIVER_PATH
165+ # -D PG_DRIVER_PATH
166+ # -D PG_SERVER
167+ # -D PG_DATABASE
168+ # -D MYSQL_DRIVER_PATH
169+ # -D MYSQL_SERVER
170+ # -D MYSQL_DATABASE
174171
175172CONFIGURE_FILE (
176173 ${ODBC_PATH} /odbcinst.ini.in
Original file line number Diff line number Diff line change @@ -84,8 +84,9 @@ class BaseFailoverIntegrationTest : public BaseConnectionTest {
8484 // Test Queries
8585 std::string DROP_TABLE_QUERY = " DROP TABLE IF EXISTS failover_transaction" ;
8686 std::string CREATE_TABLE_QUERY = " CREATE TABLE failover_transaction (id INT NOT NULL PRIMARY KEY, failover_transaction_field VARCHAR(255) NOT NULL)" ;
87- std::string SERVER_ID_QUERY = " SELECT aurora_db_instance_identifier()" ;
8887 std::string COUNT_FAILOVER_TRANSACTION_ROWS_QUERY = " SELECT count(*) FROM failover_transaction" ;
88+ // Based off of dialect
89+ std::string SERVER_ID_QUERY = " " ;
8990
9091 static void SetUpTestSuite () {
9192 BaseConnectionTest::SetUpTestSuite ();
@@ -112,6 +113,14 @@ class BaseFailoverIntegrationTest : public BaseConnectionTest {
112113 test_server.substr (cluster_id_prefix_index + cluster_prefix.size (), test_server.size ());
113114 db_conn_str_suffix = " ." + instance_endpoint;
114115 cluster_ro_url = " .cluster-ro-" + instance_endpoint;
116+
117+ if (" AURORA_POSTGRESQL" == test_dialect) {
118+ SERVER_ID_QUERY = " SELECT pg_catalog.aurora_db_instance_identifier();" ;
119+ } else if (" AURORA_MYSQL" == test_dialect) {
120+ SERVER_ID_QUERY = " SELECT @@aurora_server_id" ;
121+ } else {
122+ GTEST_SKIP () << " Failover requires database dialect to know which query to call." ;
123+ }
115124 }
116125
117126 void TearDown () override {
Original file line number Diff line number Diff line change @@ -19,3 +19,14 @@ SERVER = @PG_SERVER@
1919Driver = @MYSQL_DRIVER_PATH@
2020DATABASE = @MYSQL_DATABASE@
2121SERVER = @MYSQL_SERVER@
22+
23+ [inte-wrapper-dsn]
24+ Driver = @TEST_DRIVER_PATH@
25+ DATABASE = @TEST_DATABASE@
26+ SERVER = @TEST_SERVER@
27+ BASE_DRIVER = @BASE_DRIVER_PATH@
28+
29+ [inte-base-dsn]
30+ Driver = @BASE_DRIVER_PATH@
31+ DATABASE = @TEST_DATABASE@
32+ SERVER = @TEST_SERVER@
You can’t perform that action at this time.
0 commit comments