Skip to content

chore: run the integration tests on CodeBuild runners - #1412

Open
JuanLeee wants to merge 2 commits into
mainfrom
chore/codebuild-integration-tests-squash
Open

JuanLeee wants to merge 2 commits into
mainfrom
chore/codebuild-integration-tests-squash

Conversation

@JuanLeee

@JuanLeee JuanLeee commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Description

The integration tests can't move to CodeBuild-hosted runners as they are. CodeBuild jobs share NAT addresses, so one job's revoke cuts off the database access of the others, and anonymous Docker Hub pulls from those addresses fail with toomanyrequests. The workflows also set engine-version variables the harness no longer reads, so the Latest stage tests the default engines.

This PR adds CodeBuild versions of integration_tests.yml and blue_green_integration_tests.yml and keeps the originals as GitHub-hosted fallbacks.

  1. integration_tests_codebuild.yml and blue_green_integration_tests_codebuild.yml run the same jobs on CodeBuild runners and take over the push triggers. They share one concurrency group, so their runs never overlap on the shared addresses.
  2. Two composite actions open TCP 3306 and 5432 to each job's address, and one job at the end of the run revokes them all.
  3. SKIP_IP_AUTHORIZATION turns off the harness's own rule handling, and TEST_CONTAINER_REGISTRY=ecr pulls every image from ECR Public, with Ryuk and the Testcontainers startup check off.
  4. Before it builds an environment, the harness sweeps test- clusters, instances, parameter groups, Blue/Green deployments and Test run at rules older than 12 hours. It deletes them only when SWEEP_DRY_RUN is false, which the workflows set only on main.
  5. An environment that fails to build now deletes what it created, and every delete skips an empty or mismatched identifier.
  6. The workflows pass MYSQL_VERSION, PG_VERSION and RDS_DB_REGION, which the harness reads, and give each job a random, masked DB_PASSWORD.
  7. The async MySQL tests connect with TLS, because Aurora MySQL 8.4 refuses unencrypted connections by default.
  8. The custom endpoint workflow moves to integration_tests_custom_endpoint.yml, and IntegrationTests.md documents the new variables and the CI setup.

Behaviour changes

  1. A push to main runs the CodeBuild workflows. The GitHub-hosted ones run only on dispatch.
  2. The Latest stage now tests the newest engines (Aurora MySQL 8.4 and Aurora PostgreSQL 18).
  3. The first push to main after this merges deletes test- resources and Test run at rules older than 12 hours in the CI account.

Tests

Checks outside this PR for the workflow structure, the two actions, the sweeps and deletes (against stub clients), the image names and the TLS connect sites fail on main and pass with this change. test-docker with the test_basic_connectivity filter passed 120 tests with both Docker Hub and ECR images. pytest tests/unit -Werror, flake8, isort and mypy pass on Python 3.10 and 3.12.

On CodeBuild, the LTS stage passed 8 of 8 and the Blue/Green workflow passed 4 of 4, and the Latest MySQL job passed on Aurora MySQL 8.4 for Python 3.12. Python 3.11, 3.13 and 3.14 weren't run on 8.4. The other failures seen were an intermittent failover race in the product that also fails on main, and RDS throttling while another run shared the account.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

integration_tests_codebuild.yml and
blue_green_integration_tests_codebuild.yml now run the jobs of
integration_tests.yml and blue_green_integration_tests.yml on
CodeBuild-hosted runners and take their push triggers. The originals
keep workflow_dispatch as the GitHub-hosted fallback. The custom
endpoint workflow moves to integration_tests_custom_endpoint.yml.

CodeBuild jobs share outbound addresses. Each job opens TCP 3306 and
5432 on the default security group to its own address and records it,
and one job per run revokes every recorded address. The workflows set
SKIP_IP_AUTHORIZATION, so the harness never revokes a rule that another
job still uses, and TEST_CONTAINER_REGISTRY=ecr, so the images come
from ECR Public instead of Docker Hub. Both workflows share one
concurrency group, so one run's revoke job can't cut off the other's
jobs.

Harness changes:
- ContainerImages holds every image name. dockerhub, the default, keeps
  the current names, and a value other than dockerhub or ecr fails at
  once. With ecr, the Gradle test tasks turn off Ryuk and the
  Testcontainers startup check unless those variables are set.
- Before each AWS environment build, sweeps delete test- clusters,
  instances, parameter groups, Blue/Green deployments and "Test run at"
  rules that are more than 12 hours old. Unless SWEEP_DRY_RUN is false,
  they only log. The workflows set it to false only on main.
- An environment that fails to build now deletes what it created. Each
  delete skips an empty identifier and acts only on the cluster it asked
  for, because a lookup with no identifier returns every cluster in the
  region.
- The harness rule is TCP 3306 and 5432 instead of every port, the RDS
  and EC2 clients retry throttling with the adaptive strategy, and the
  log names the Docker host that Testcontainers uses.

The workflows set MYSQL_VERSION, PG_VERSION and RDS_DB_REGION instead
of four names the harness no longer reads, so the Latest stage now
tests the latest engine versions. Each test job sets a random, masked
DB_PASSWORD. Aurora MySQL 8.4 refuses unencrypted connections, so the
aiomysql test connections now use TLS without verifying the server
certificate, as mysql-connector does by default.
@JuanLeee
JuanLeee marked this pull request as ready for review December 4, 2026 00:27

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant