Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/race_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Race Tests

on:
workflow_dispatch:
pull_request:
branches:
- "test/race-tests"
push:
branches:
- "test/race-tests"
paths-ignore:
- "**/*.md"
- "docs/**"

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

jobs:
run-integration-tests:
name: Run Race Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dbEngine: ["aurora-mysql", "aurora-pg"]
steps:
- name: 'Clone repository'
uses: actions/checkout@v4
- name: "Set up JDK 8"
uses: actions/setup-java@v3
with:
distribution: "corretto"
java-version: 8
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.24'
cache-dependency-path: .test/go.sum
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_DEPLOY_ROLE }}
role-session-name: go_int_test
role-duration-seconds: 21600
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Run Integration Tests
run: |
cd .test/test_framework/host && ./gradlew --no-parallel --no-daemon test-${{ matrix.dbEngine }}-race --info
env:
RDS_DB_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AURORA_MYSQL_DB_ENGINE_VERSION: "default"
AURORA_PG_DB_ENGINE_VERSION: "default"
RDS_MYSQL_DB_ENGINE_VERSION: "default"
RDS_PG_DB_ENGINE_VERSION: "default"
AWS_RDS_MONITORING_ROLE_ARN: ${{ secrets.AWS_RDS_MONITORING_ROLE_ARN }}
- name: "Get Github Action IP"
if: always()
id: ip
uses: haythem/public-ip@v1.3

- name: "Remove Github Action IP"
if: always()
run: |
aws ec2 revoke-security-group-ingress \
--group-name default \
--protocol -1 \
--port -1 \
--cidr ${{ steps.ip.outputs.ipv4 }}/32 \
2>&1 > /dev/null;
- name: Archive results
if: always()
uses: actions/upload-artifact@v4
with:
name: integration-report-default-${{ matrix.dbEngine }}
path: ./.test/test_framework/container/reports
retention-days: 5
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const (
NETWORK_OUTAGES_ENABLED TestEnvironmentFeatures = "NETWORK_OUTAGES_ENABLED"
AWS_CREDENTIALS_ENABLED TestEnvironmentFeatures = "AWS_CREDENTIALS_ENABLED"
PERFORMANCE TestEnvironmentFeatures = "PERFORMANCE"
RACE TestEnvironmentFeatures = "RACE"
RUN_AUTOSCALING_TESTS_ONLY TestEnvironmentFeatures = "RUN_AUTOSCALING_TESTS_ONLY"
SKIP_MYSQL_DRIVER_TESTS TestEnvironmentFeatures = "SKIP_MYSQL_DRIVER_TESTS"
SKIP_PG_DRIVER_TESTS TestEnvironmentFeatures = "SKIP_PG_DRIVER_TESTS"
Expand Down
61 changes: 61 additions & 0 deletions .test/test_framework/host/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ tasks.register<Test>("test-docker") {
systemProperty("exclude-multi-az", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -109,6 +110,7 @@ tasks.register<Test>("test-aurora") {
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -124,6 +126,7 @@ tasks.register<Test>("test-aurora-postgres") {
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -140,6 +143,7 @@ tasks.register<Test>("test-aurora-mysql") {
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -162,6 +166,7 @@ tasks.register<Test>("test-aurora-pg-performance") {
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -176,6 +181,7 @@ tasks.register<Test>("test-aurora-mysql-performance") {
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -192,6 +198,7 @@ tasks.register<Test>("test-multi-az-postgres") {
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -207,6 +214,7 @@ tasks.register<Test>("test-multi-az-mysql") {
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -221,6 +229,7 @@ tasks.register<Test>("test-autoscaling") {
systemProperty("test-autoscaling", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -237,6 +246,7 @@ tasks.register<Test>("test-autoscaling-mysql") {
systemProperty("test-autoscaling", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -253,6 +263,7 @@ tasks.register<Test>("test-autoscaling-postgres") {
systemProperty("test-autoscaling", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -267,6 +278,7 @@ tasks.register<Test>("test-bgd-mysql-aurora") {
systemProperty("exclude-multi-az-cluster", "true")
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -282,6 +294,7 @@ tasks.register<Test>("test-bgd-mysql-multiaz") {
systemProperty("exclude-multi-az-cluster", "true")
systemProperty("exclude-multi-az-instance", "false")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -296,6 +309,7 @@ tasks.register<Test>("test-bgd-pg-aurora") {
systemProperty("exclude-multi-az-cluster", "true")
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -311,6 +325,7 @@ tasks.register<Test>("test-bgd-pg-multiaz") {
systemProperty("exclude-multi-az-cluster", "true")
systemProperty("exclude-multi-az-instance", "false")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -327,6 +342,40 @@ tasks.register<Test>("test-aurora-limitless-postgres") {
systemProperty("exclude-bg", "true")
systemProperty("exclude-limitless", "false")
systemProperty("limitless-only", "true")
systemProperty("exclude-race", "true")
}
}

// TODO: change these filters
tasks.register<Test>("test-aurora-pg-race") {
group = "verification"
filter.includeTestsMatching("integration.host.TestRunner.runTests")
doFirst {
systemProperty("exclude-docker", "true")
systemProperty("exclude-performance", "true")
systemProperty("exclude-failover", "true")
systemProperty("exclude-multi-az", "true")
systemProperty("exclude-mysql-driver", "true")
systemProperty("exclude-mysql-engine", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-race", "false")
}
}

tasks.register<Test>("test-aurora-mysql-race") {
group = "verification"
filter.includeTestsMatching("integration.host.TestRunner.runTests")
doFirst {
systemProperty("exclude-docker", "true")
systemProperty("exclude-performance", "true")
systemProperty("exclude-failover", "true")
systemProperty("exclude-multi-az", "true")
systemProperty("exclude-mysql-driver", "true")
systemProperty("exclude-mysql-engine", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-race", "false")
}
}

Expand All @@ -337,6 +386,7 @@ tasks.register<Test>("debug-all-environments") {
filter.includeTestsMatching("integration.host.TestRunner.debugTests")
doFirst {
systemProperty("exclude-performance", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -350,6 +400,7 @@ tasks.register<Test>("debug-docker") {
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -363,6 +414,7 @@ tasks.register<Test>("debug-aurora") {
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -378,6 +430,7 @@ tasks.register<Test>("debug-aurora-postgres") {
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -393,6 +446,7 @@ tasks.register<Test>("debug-aurora-mysql") {
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -407,6 +461,7 @@ tasks.register<Test>("debug-aurora-pg-performance") {
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -421,6 +476,7 @@ tasks.register<Test>("debug-aurora-mysql-performance") {
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -435,6 +491,7 @@ tasks.register<Test>("debug-multi-az-mysql") {
systemProperty("exclude-aurora", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -449,6 +506,7 @@ tasks.register<Test>("debug-multi-az-postgres") {
systemProperty("exclude-aurora", "true")
systemProperty("exclude-bg", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -463,6 +521,7 @@ tasks.register<Test>("debug-autoscaling") {
systemProperty("exclude-bg", "true")
systemProperty("exclude-limitless", "true")
systemProperty("test-autoscaling", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -479,6 +538,7 @@ tasks.register<Test>("debug-aurora-limitless-postgres") {
systemProperty("exclude-bg", "true")
systemProperty("exclude-limitless", "false")
systemProperty("limitless-only", "true")
systemProperty("exclude-race", "true")
}
}

Expand All @@ -493,5 +553,6 @@ tasks.register<Test>("debug-bgd-mysql-aurora") {
systemProperty("exclude-multi-az-cluster", "true")
systemProperty("exclude-multi-az-instance", "true")
systemProperty("exclude-limitless", "true")
systemProperty("exclude-race", "true")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,8 @@ private static String getEnvironmentInfoAsString(TestEnvironmentConfig env) {
public void runTests() throws IOException, InterruptedException {
final ContainerHelper containerHelper = new ContainerHelper();
boolean isPerformanceTest = info.getRequest().getFeatures().contains(TestEnvironmentFeatures.PERFORMANCE);
containerHelper.runTest(this.testContainer, isPerformanceTest);
boolean isRaceTest = info.getRequest().getFeatures().contains(TestEnvironmentFeatures.RACE);
containerHelper.runTest(this.testContainer, isPerformanceTest, isRaceTest);
}

public void debugTests() throws IOException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public enum TestEnvironmentFeatures {
NETWORK_OUTAGES_ENABLED,
AWS_CREDENTIALS_ENABLED,
PERFORMANCE,
RACE,
RUN_AUTOSCALING_TESTS_ONLY,
SKIP_MYSQL_DRIVER_TESTS,
SKIP_PG_DRIVER_TESTS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContex
final boolean excludeLimitless = Boolean.parseBoolean(System.getProperty("exclude-limitless", "true"));
final boolean excludePerformance =
Boolean.parseBoolean(System.getProperty("exclude-performance", "false"));
final boolean excludeRace =
Boolean.parseBoolean(System.getProperty("exclude-race", "false"));
final boolean excludeMysqlEngine =
Boolean.parseBoolean(System.getProperty("exclude-mysql-engine", "false"));
final boolean excludeMysqlDriver =
Expand Down Expand Up @@ -149,6 +151,7 @@ public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContex
: TestEnvironmentFeatures.IAM,
excludeSecretsManager ? null : TestEnvironmentFeatures.SECRETS_MANAGER,
excludePerformance ? null : TestEnvironmentFeatures.PERFORMANCE,
excludeRace ? null : TestEnvironmentFeatures.RACE,
excludeMysqlDriver ? TestEnvironmentFeatures.SKIP_MYSQL_DRIVER_TESTS : null,
excludePgDriver ? TestEnvironmentFeatures.SKIP_PG_DRIVER_TESTS : null,
testAutoscalingOnly ? TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Long runCmdInDirectory(GenericContainer<?> container, String workingDirec
return exitCode;
}

public void runTest(GenericContainer<?> container, boolean isPerformanceTest)
public void runTest(GenericContainer<?> container, boolean isPerformanceTest, boolean isRaceTest)
throws IOException, InterruptedException {
System.out.println("==== Container console feed ==== >>>>");
Consumer<OutputFrame> consumer = new ConsoleConsumer(true);
Expand All @@ -98,6 +98,13 @@ public void runTest(GenericContainer<?> container, boolean isPerformanceTest)
Long exitCode;
if (isPerformanceTest) {
exitCode = execInContainer(container, "/app/.test/", consumer, "go", "test", "-timeout", timeout, PERFORMANCE_TEST_TAG, "-run", PERFORMANCE_TEST_FILTER, "-v", "./test_framework/container/tests...");
} else if (isRaceTest) {
if (filter != null) {
exitCode = execInContainer(container, "/app/.test/", consumer, "go", "test", "-race", "-timeout", timeout, "-v", "./test_framework/container/tests/stress_test.go", "-run", filter);
} else {
// Run all tests located in aws-advanced-go-wrapper/.test/test_framework/container.
exitCode = execInContainer(container, "/app/.test/", consumer, "go", "test", "-race", "-timeout", timeout, "-v", "./test_framework/container/tests/stress_test.go");
}
} else if (filter != null) {
exitCode = execInContainer(container, "/app/.test/", consumer, "go", "test", "-timeout", timeout, "-v", "./test_framework/container/tests...", "-run", filter);
} else {
Expand Down
Loading