From 488a3197f19b63f3398753afdbae7827dfc85844 Mon Sep 17 00:00:00 2001 From: Hector Ventura Date: Sun, 1 Nov 2026 10:20:58 -0600 Subject: [PATCH] chore(compat): close the SES races and report pre-pull and class timings (#7221) Review of #7212 left three gaps in the parallel sdk-test-java setup. The classes that create SES contact lists share a one-list-per-account limit and three of them delete every list, and SesAccountAttributesTest turns account sending off while other classes send. All of them now hold ses-account, which costs about 8 s of serial time. The pre-pull step discarded its output, so a failed pull only showed as a slower run. Each pull now records its result and duration, and a step puts them in the job summary with a warning when one failed. Under JUnit parallel execution Surefire writes some test cases into another class's XML file, so the timing report credited them to the wrong class. It now sums per test case classname, which also splits sdk-test-python's single "pytest" row into its classes. Signed-off-by: Hector Ventura --- .github/ci/compat-timing-report.py | 27 +++++++++++++------ .github/workflows/compatibility.yml | 19 ++++++++++++- .../test/SesConfigurationSetSendingTest.java | 2 ++ .../com/floci/test/SesContactFilterTest.java | 2 ++ .../com/floci/test/SesContactListTest.java | 2 ++ .../com/floci/test/SesContactPagingTest.java | 2 ++ .../java/com/floci/test/SesContactTest.java | 2 ++ .../floci/test/SesEventPublishingTest.java | 2 ++ .../java/com/floci/test/SesImportJobTest.java | 2 ++ .../floci/test/SesSendEmailOptionsTest.java | 2 ++ .../com/floci/test/SesTagResourceTest.java | 2 ++ .../java/com/floci/test/SesTemplateTest.java | 2 ++ .../java/com/floci/test/SesTenantTest.java | 2 ++ 13 files changed, 59 insertions(+), 9 deletions(-) diff --git a/.github/ci/compat-timing-report.py b/.github/ci/compat-timing-report.py index 068fa8a762..ea1cdf061b 100755 --- a/.github/ci/compat-timing-report.py +++ b/.github/ci/compat-timing-report.py @@ -4,7 +4,13 @@ Usage: compat-timing-report.py Also appends the table to GITHUB_STEP_SUMMARY when set. Never fails the job: bad or absent XMLs produce an empty report, not an error. + +Times are summed per test case classname, not read from the testsuite element: +under JUnit parallel execution Surefire writes some test cases into another +class's XML file, but each one still names its own class. Class-level setup +outside a test case is not counted. """ +from collections import defaultdict import glob import os import sys @@ -12,7 +18,8 @@ import xml.etree.ElementTree as ET def main(): d = sys.argv[1] if len(sys.argv) > 1 else 'test-results' - rows = [] + times = defaultdict(float) + counts = defaultdict(int) for f in glob.glob(os.path.join(d, '*.xml')): try: root = ET.parse(f).getroot() @@ -21,16 +28,20 @@ def main(): continue suites = root.iter('testsuite') if root.tag != 'testsuite' else [root] for ts in suites: - try: - rows.append((float(ts.get('time') or 0), int(ts.get('tests') or 0), - ts.get('name') or os.path.basename(f))) - except ValueError as exc: - print(f'warning: skipping suite with non-numeric attributes in {f}: {exc}', - file=sys.stderr) + for tc in ts.iter('testcase'): + name = tc.get('classname') or ts.get('name') or os.path.basename(f) + try: + times[name] += float(tc.get('time') or 0) + except ValueError as exc: + print(f'warning: skipping test case with a non-numeric time in {f}: {exc}', + file=sys.stderr) + continue + counts[name] += 1 + rows = [(times[name], counts[name], name) for name in counts] rows.sort(reverse=True) total_t = sum(r[0] for r in rows) total_n = sum(r[1] for r in rows) - lines = [f'== {len(rows)} suites, {total_n} tests, {total_t / 60:.1f} min total test time', + lines = [f'== {len(rows)} classes, {total_n} tests, {total_t / 60:.1f} min total test time', '== slowest 25 classes:'] lines += [f'{t:8.1f}s {n:5d} tests {name}' for t, n, name in rows[:25]] report = '\n'.join(lines) diff --git a/.github/workflows/compatibility.yml b/.github/workflows/compatibility.yml index 2ec65b12d6..c285e3ff48 100644 --- a/.github/workflows/compatibility.yml +++ b/.github/workflows/compatibility.yml @@ -345,7 +345,11 @@ jobs: public.ecr.aws/lambda/nodejs:20 public.ecr.aws/lambda/provided:al2023 \ floci/floci-duck:latest floci/floci-sidecar-cedar:1.1.0 floci/floci-sidecar-graphql:0.2.0 \ nginx:alpine nginx:latest alpine:3 alpine:latest busybox:stable busybox:latest; do - nohup docker pull -q "$image" > /dev/null 2>&1 & + nohup bash -c ' + start=$SECONDS + if err=$(docker pull -q "$1" 2>&1 >/dev/null); then result=ok; else result=FAILED; fi + echo "$result $((SECONDS - start))s $1 $err" >> "$RUNNER_TEMP/pre-pull.log" + ' _ "$image" > /dev/null 2>&1 & done - name: Create Docker network @@ -466,6 +470,19 @@ jobs: continue-on-error: true run: python3 .github/ci/compat-timing-report.py test-results + # An image missing from the list was still pulling when the tests ended. A failed pull falls + # back to Floci pulling it during the tests, so it costs time, not the leg. + - name: Report pre-pull results + if: always() && matrix.test == 'sdk-test-java' && steps.tests.outcome != 'skipped' + continue-on-error: true + run: | + log="$RUNNER_TEMP/pre-pull.log" + touch "$log" + { echo '```'; sort "$log"; echo '```'; } | tee -a "$GITHUB_STEP_SUMMARY" + if grep -q '^FAILED' "$log"; then + echo "::warning::$(grep -c '^FAILED' "$log") pre-pulled images failed, see the job summary" + fi + - name: Upload test results if: always() && steps.tests.outcome != 'skipped' timeout-minutes: 2 diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesConfigurationSetSendingTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesConfigurationSetSendingTest.java index 418157ea41..de010bff49 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesConfigurationSetSendingTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesConfigurationSetSendingTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.parallel.ResourceLock; import software.amazon.awssdk.services.ses.SesClient; import software.amazon.awssdk.services.ses.model.ConfigurationSetAttribute; import software.amazon.awssdk.services.ses.model.DescribeConfigurationSetRequest; @@ -48,6 +49,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; */ @DisplayName("SES Per-Configuration-Set Sending Toggle (v1 + v2)") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@ResourceLock("ses-account") class SesConfigurationSetSendingTest { private static final String CS_NAME = "compat-cs-sending"; diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactFilterTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactFilterTest.java index 635aade856..933fa61a34 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactFilterTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactFilterTest.java @@ -4,6 +4,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.ResourceLock; import software.amazon.awssdk.services.sesv2.SesV2Client; import software.amazon.awssdk.services.sesv2.model.Contact; import software.amazon.awssdk.services.sesv2.model.CreateContactListRequest; @@ -23,6 +24,7 @@ import static org.junit.jupiter.api.Assumptions.assumeFalse; // Runs as its own account, so the one contact list it needs leaves every other test's list alone. @DisplayName("SES v2 ListContacts filter") +@ResourceLock("ses-account") class SesContactFilterTest { private static final String ACCOUNT_ID = "777788880000"; diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactListTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactListTest.java index 4a27f6f528..50b391f050 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactListTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactListTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.parallel.ResourceLock; import software.amazon.awssdk.services.sesv2.SesV2Client; import software.amazon.awssdk.services.sesv2.model.BadRequestException; import software.amazon.awssdk.services.sesv2.model.CreateContactListRequest; @@ -33,6 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; */ @DisplayName("SES v2 Contact Lists") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@ResourceLock("ses-account") class SesContactListTest { private static final String LIST = "compat-contact-list"; diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactPagingTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactPagingTest.java index e2ac21b422..d6ae2be510 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactPagingTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactPagingTest.java @@ -4,6 +4,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.ResourceLock; import software.amazon.awssdk.services.sesv2.SesV2Client; import software.amazon.awssdk.services.sesv2.model.Contact; import software.amazon.awssdk.services.sesv2.model.CreateContactListRequest; @@ -21,6 +22,7 @@ import static org.junit.jupiter.api.Assumptions.assumeFalse; // Runs as its own account, so the one contact list it needs leaves every other test's list alone. @DisplayName("SES v2 contact and contact list paging") +@ResourceLock("ses-account") class SesContactPagingTest { private static final String ACCOUNT_ID = "777788889999"; diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactTest.java index d5d12b65d0..4794d5c735 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesContactTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.parallel.ResourceLock; import software.amazon.awssdk.services.sesv2.SesV2Client; import software.amazon.awssdk.services.sesv2.model.AlreadyExistsException; import software.amazon.awssdk.services.sesv2.model.BadRequestException; @@ -33,6 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; */ @DisplayName("SES v2 Contacts") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@ResourceLock("ses-account") class SesContactTest { private static final String LIST = "compat-contacts-list"; diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesEventPublishingTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesEventPublishingTest.java index 2328052b3a..2557c8cca4 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesEventPublishingTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesEventPublishingTest.java @@ -9,6 +9,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.parallel.ResourceLock; import software.amazon.awssdk.services.cloudwatch.CloudWatchClient; import software.amazon.awssdk.services.cloudwatch.model.ListMetricsRequest; import software.amazon.awssdk.services.cloudwatch.model.Metric; @@ -94,6 +95,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @DisplayName("SES Event Publishing") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@ResourceLock("ses-account") class SesEventPublishingTest { private static final ObjectMapper MAPPER = new ObjectMapper(); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesImportJobTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesImportJobTest.java index e4408842b1..03a30293b7 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesImportJobTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesImportJobTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.parallel.ResourceLock; import software.amazon.awssdk.core.sync.RequestBody; import software.amazon.awssdk.services.s3.S3Client; import software.amazon.awssdk.services.s3.model.CreateBucketRequest; @@ -55,6 +56,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; */ @DisplayName("SES v2 Import Jobs") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@ResourceLock("ses-account") class SesImportJobTest { private static final String BUCKET = "floci-ses-import-job-sdk-test"; diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesSendEmailOptionsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesSendEmailOptionsTest.java index e549c93e19..7b68c3c051 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesSendEmailOptionsTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesSendEmailOptionsTest.java @@ -4,6 +4,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.ResourceLock; import software.amazon.awssdk.services.sesv2.SesV2Client; import software.amazon.awssdk.services.sesv2.model.AlreadyExistsException; import software.amazon.awssdk.services.sesv2.model.BadRequestException; @@ -41,6 +42,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; * */ @DisplayName("SES v2 SendEmail request options") +@ResourceLock("ses-account") class SesSendEmailOptionsTest { private static final String LIST = "compat-lmo-list"; diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesTagResourceTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesTagResourceTest.java index fca7962ce6..06ef1a3764 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesTagResourceTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesTagResourceTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.parallel.ResourceLock; import software.amazon.awssdk.services.sesv2.SesV2Client; import software.amazon.awssdk.services.sesv2.model.CreateConfigurationSetRequest; import software.amazon.awssdk.services.sesv2.model.CreateContactListRequest; @@ -41,6 +42,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; @DisplayName("SES V2 TagResource / UntagResource / ListTagsForResource") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@ResourceLock("ses-account") class SesTagResourceTest { private static SesV2Client sesV2; diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesTemplateTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesTemplateTest.java index 7ad918a8ab..41561a7e35 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesTemplateTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesTemplateTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.parallel.ResourceLock; import software.amazon.awssdk.awscore.exception.AwsServiceException; import software.amazon.awssdk.services.ses.SesClient; import software.amazon.awssdk.services.ses.model.BulkEmailDestination; @@ -61,6 +62,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; */ @DisplayName("SES Email Templates") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@ResourceLock("ses-account") class SesTemplateTest { private static SesClient sesV1; diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesTenantTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesTenantTest.java index 456ba7787b..216e3c4380 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesTenantTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesTenantTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.parallel.ResourceLock; import software.amazon.awssdk.services.sesv2.SesV2Client; import software.amazon.awssdk.services.sesv2.model.AlreadyExistsException; import software.amazon.awssdk.services.sesv2.model.BadRequestException; @@ -56,6 +57,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; */ @DisplayName("SES v2 Tenants") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@ResourceLock("ses-account") class SesTenantTest { private static final String TENANT = "compat-tenant-alpha";