From dc49d89654c02dff9e40454c62d444a8cdac6bdc Mon Sep 17 00:00:00 2001 From: Karen <64801825+karenc-bq@users.noreply.github.com> Date: Thu, 16 Jan 2025 17:46:06 -0800 Subject: [PATCH] refactor: remove dependency on RDS_CLUSTER_DOMAIN (#373) --- .github/workflows/aurora_performance.yml | 1 - .github/workflows/integration_tests.yml | 1 - .github/workflows/integration_tests_latest.yml | 1 - .github/workflows/multi_az_integration_tests.yml | 1 - .github/workflows/run-autoscaling-tests.yml | 1 - .../test/java/integration/host/TestEnvironmentConfig.java | 7 +++---- .../java/integration/host/util/AuroraTestUtility.java | 8 ++++---- 7 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/workflows/aurora_performance.yml b/.github/workflows/aurora_performance.yml index 4a170b81..33ce6d49 100644 --- a/.github/workflows/aurora_performance.yml +++ b/.github/workflows/aurora_performance.yml @@ -55,7 +55,6 @@ jobs: run: | ./gradlew --no-parallel --no-daemon test-aurora-${{ matrix.db }}-performance --info env: - RDS_CLUSTER_DOMAIN: ${{ secrets.DB_CONN_SUFFIX }} RDS_DB_REGION: ${{ secrets.AWS_DEFAULT_REGION }} AWS_ACCESS_KEY_ID: ${{ env.TEMP_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ env.TEMP_AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 52594b28..228276b2 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -63,7 +63,6 @@ jobs: run: | ./gradlew --no-parallel --no-daemon test-aurora-${{ matrix.dbEngine }} --info env: - RDS_CLUSTER_DOMAIN: ${{ secrets.DB_CONN_SUFFIX }} RDS_DB_REGION: ${{ secrets.AWS_DEFAULT_REGION }} AWS_ACCESS_KEY_ID: ${{ env.TEMP_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ env.TEMP_AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/integration_tests_latest.yml b/.github/workflows/integration_tests_latest.yml index 4c5c3724..5793527b 100644 --- a/.github/workflows/integration_tests_latest.yml +++ b/.github/workflows/integration_tests_latest.yml @@ -66,7 +66,6 @@ jobs: run: | ./gradlew --no-parallel --no-daemon test-aurora-${{ matrix.dbEngine }} --info env: - RDS_CLUSTER_DOMAIN: ${{ secrets.DB_CONN_SUFFIX }} RDS_DB_REGION: ${{ secrets.AWS_DEFAULT_REGION }} AWS_ACCESS_KEY_ID: ${{ env.TEMP_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ env.TEMP_AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/multi_az_integration_tests.yml b/.github/workflows/multi_az_integration_tests.yml index 6a1c4c31..f8e9e4d7 100644 --- a/.github/workflows/multi_az_integration_tests.yml +++ b/.github/workflows/multi_az_integration_tests.yml @@ -63,7 +63,6 @@ jobs: run: | ./gradlew --no-parallel --no-daemon test-${{ matrix.dbEngine }} --info env: - RDS_CLUSTER_DOMAIN: ${{ secrets.DB_CONN_SUFFIX }} RDS_DB_REGION: ${{ secrets.AWS_DEFAULT_REGION }} AWS_ACCESS_KEY_ID: ${{ env.TEMP_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ env.TEMP_AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/run-autoscaling-tests.yml b/.github/workflows/run-autoscaling-tests.yml index e34b3b8e..15ad791d 100644 --- a/.github/workflows/run-autoscaling-tests.yml +++ b/.github/workflows/run-autoscaling-tests.yml @@ -52,7 +52,6 @@ jobs: run: | ./gradlew --no-parallel --no-daemon test-autoscaling-${{ matrix.dbEngine }} --info env: - RDS_CLUSTER_DOMAIN: ${{ secrets.DB_CONN_SUFFIX }} RDS_DB_REGION: ${{ secrets.AWS_DEFAULT_REGION }} AWS_ACCESS_KEY_ID: ${{ env.TEMP_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ env.TEMP_AWS_SECRET_ACCESS_KEY }} diff --git a/tests/integration/host/src/test/java/integration/host/TestEnvironmentConfig.java b/tests/integration/host/src/test/java/integration/host/TestEnvironmentConfig.java index ed68d160..9865f185 100644 --- a/tests/integration/host/src/test/java/integration/host/TestEnvironmentConfig.java +++ b/tests/integration/host/src/test/java/integration/host/TestEnvironmentConfig.java @@ -242,10 +242,6 @@ private static void createDbCluster(TestEnvironmentConfig env, int numOfInstance env.rdsMySqlDbEngineVersion = System.getenv("RDS_MYSQL_DB_ENGINE_VERSION"); // "latest", "default" env.rdsPgDbEngineVersion = System.getenv("RDS_PG_DB_ENGINE_VERSION"); - if (StringUtils.isNullOrEmpty(env.auroraClusterDomain)) { - throw new RuntimeException("Environment variable RDS_CLUSTER_DOMAIN is required."); - } - env.auroraUtil = new AuroraTestUtility( env.info.getRegion(), @@ -257,6 +253,9 @@ private static void createDbCluster(TestEnvironmentConfig env, int numOfInstance ArrayList instances = new ArrayList<>(); if (env.reuseAuroraDbCluster) { + if (StringUtils.isNullOrEmpty(env.auroraClusterDomain)) { + throw new RuntimeException("Environment variable RDS_CLUSTER_DOMAIN is required when testing against an existing Aurora DB cluster."); + } if (!env.auroraUtil.doesClusterExist(env.auroraClusterName)) { throw new RuntimeException( "It's requested to reuse existing DB cluster but it doesn't exist: " diff --git a/tests/integration/host/src/test/java/integration/host/util/AuroraTestUtility.java b/tests/integration/host/src/test/java/integration/host/util/AuroraTestUtility.java index 081536c1..e6d03fda 100644 --- a/tests/integration/host/src/test/java/integration/host/util/AuroraTestUtility.java +++ b/tests/integration/host/src/test/java/integration/host/util/AuroraTestUtility.java @@ -252,7 +252,7 @@ public String createAuroraCluster() throws InterruptedException { builder.filters( Filter.builder().name("db-cluster-id").values(dbIdentifier).build())); final String endpoint = dbInstancesResult.dbInstances().get(0).endpoint().address(); - final String clusterDomainPrefix = endpoint.substring(endpoint.indexOf('.') + 1); + final String clusterDomainSuffix = endpoint.substring(endpoint.indexOf('.') + 1); for (DBInstance instance : dbInstancesResult.dbInstances()) { this.instances.add( @@ -262,7 +262,7 @@ public String createAuroraCluster() throws InterruptedException { instance.endpoint().port())); } - return clusterDomainPrefix; + return clusterDomainSuffix; } /** @@ -320,7 +320,7 @@ public String createMultiAzCluster() throws InterruptedException { builder.filters( Filter.builder().name("db-cluster-id").values(dbIdentifier).build())); final String endpoint = dbInstancesResult.dbInstances().get(0).endpoint().address(); - final String clusterDomainPrefix = endpoint.substring(endpoint.indexOf('.') + 1); + final String clusterDomainSuffix = endpoint.substring(endpoint.indexOf('.') + 1); for (DBInstance instance : dbInstancesResult.dbInstances()) { this.instances.add( @@ -330,7 +330,7 @@ public String createMultiAzCluster() throws InterruptedException { instance.endpoint().port())); } - return clusterDomainPrefix; + return clusterDomainSuffix; } /**