From 065d7194b05dd8a71c7f17de3c9ddab3a1fbe30d Mon Sep 17 00:00:00 2001 From: Andre Kurait Date: Sun, 15 Nov 2026 16:20:50 -0600 Subject: [PATCH] fix(ci): distribute slow classes sharing a test profile (#8511) --- .github/ci/partition.sh | 10 ++++++++-- .github/ci/test_partition.py | 10 +++++++--- .../CodeArtifactNpmDataPlaneTest.java | 20 +++++++++++-------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/ci/partition.sh b/.github/ci/partition.sh index 6350ec4f42..65b634f058 100755 --- a/.github/ci/partition.sh +++ b/.github/ci/partition.sh @@ -5,11 +5,13 @@ Usage: partition.sh holds one test class per line in surefire includesFile path format (io/github/.../FooTest, no extension). Classes sharing a @TestProfile are -assigned to the SAME shard atomically: per-shard Quarkus augmentation cost is +assigned to the SAME shard atomically, except known slow classes: per-shard Quarkus augmentation cost is (distinct profiles in shard) x ~5.4s, so splitting a profile group pays its augmentation once per shard it touches. Profile-less classes fill the remainder. A class counts as one, but for the few in SLOW_CLASSES, whose run time would -otherwise be invisible to a partition that balances class counts. +otherwise be invisible to a partition that balances class counts. These are +separate groups even when they share a profile: saving one augmentation must +not force minutes of Docker work onto the same shard. Deterministic: sorted inputs, greedy least-loaded bin-packing, no RNG/timestamps. Exit 2 on bad arguments or an unreadable input file. @@ -86,6 +88,10 @@ def main(): if key is None: plain.append(c) else: + if weight(c) > 1: + key = (key, c) + else: + key = (key, '') groups.setdefault(key, []).append(c) load = [0] * total diff --git a/.github/ci/test_partition.py b/.github/ci/test_partition.py index f60cd95677..19b35b99cb 100644 --- a/.github/ci/test_partition.py +++ b/.github/ci/test_partition.py @@ -114,11 +114,15 @@ class PartitionTest(unittest.TestCase): shards = self.shards(['some/where/EmrHiveStepsDockerIntegrationTest'] + plain, 2) self.assertEqual(['some/where/EmrHiveStepsDockerIntegrationTest'], shards[0]) - def test_two_slow_classes_of_one_profile_stay_together(self): + def test_two_slow_classes_of_one_profile_are_separate_from_each_other_and_ordinary_members(self): self.source('p/EmrDockerRunnerDockerIntegrationTest', '@TestProfile(Docker.class)') self.source('p/EmrHiveStepsDockerIntegrationTest', '@TestProfile(Docker.class)') - shards = self.shards(['p/EmrDockerRunnerDockerIntegrationTest', 'p/EmrHiveStepsDockerIntegrationTest', 'p/A'], 2) - self.assertEqual(['p/EmrDockerRunnerDockerIntegrationTest', 'p/EmrHiveStepsDockerIntegrationTest'], shards[0]) + self.source('p/A', '@TestProfile(Docker.class)') + self.source('p/B', '@TestProfile(Docker.class)') + classes = ['p/EmrDockerRunnerDockerIntegrationTest', 'p/EmrHiveStepsDockerIntegrationTest', 'p/A', 'p/B'] + shards = self.shards(classes, 3) + self.assertEqual([['p/EmrDockerRunnerDockerIntegrationTest'], + ['p/EmrHiveStepsDockerIntegrationTest'], ['p/A', 'p/B']], shards) def test_a_slow_class_that_no_longer_exists_is_named_and_changes_nothing(self): self.classes.write_text('p/A\np/EmrHiveStepsDockerIntegrationTest\n') diff --git a/src/test/java/io/floci/aws/services/codeartifact/CodeArtifactNpmDataPlaneTest.java b/src/test/java/io/floci/aws/services/codeartifact/CodeArtifactNpmDataPlaneTest.java index 8a07bb75dd..335296f260 100644 --- a/src/test/java/io/floci/aws/services/codeartifact/CodeArtifactNpmDataPlaneTest.java +++ b/src/test/java/io/floci/aws/services/codeartifact/CodeArtifactNpmDataPlaneTest.java @@ -913,8 +913,11 @@ class CodeArtifactNpmDataPlaneTest { givenStoredVersion(verdaccioClient, null, "big-pkg", "1.0.0", "big-pkg-1.0.0.tgz", content, Map.of()); startDataPlane(service, verdaccioClient); - HttpResponse response = put("/codeartifact/npm/" + DOMAIN + "/" + REPOSITORY + "/big-pkg", "good-token", - npmPublishEnvelope("big-pkg", "1.0.0", "big-pkg-1.0.0.tgz", content)); + // This streams roughly 94 MiB through HTTP and disk before hashing it. Its correctness + // assertion needs a separate deadline from the small routing requests on a busy runner. + HttpResponse response = request(HttpMethod.PUT, + "/codeartifact/npm/" + DOMAIN + "/" + REPOSITORY + "/big-pkg", "good-token", + npmPublishEnvelope("big-pkg", "1.0.0", "big-pkg-1.0.0.tgz", content), null, 30); assertEquals(200, response.statusCode()); assertEquals(false, upstreamReceivedPut.get()); @@ -1639,6 +1642,11 @@ class CodeArtifactNpmDataPlaneTest { private HttpResponse request(HttpMethod method, String path, String bearerToken, String body, String accept) throws Exception { + return request(method, path, bearerToken, body, accept, 6); + } + + private HttpResponse request(HttpMethod method, String path, String bearerToken, String body, String accept, + int timeoutSeconds) throws Exception { RequestOptions options = new RequestOptions() .setHost("127.0.0.1") .setPort(dataPlane.actualPort()) @@ -1659,12 +1667,8 @@ class CodeArtifactNpmDataPlaneTest { resp.headers().forEach(h -> headers.put(h.getKey().toLowerCase(), h.getValue())); return new HttpResponse(resp.statusCode(), buffer.toString(StandardCharsets.UTF_8), headers); })); - // 6 seconds, not the 2 used elsewhere in this file: this single wait now covers every - // stage of the chain above (request creation, send, body read) rather than one stage each - // getting its own 2-second budget the way three separate blocking calls used to, so it - // needs the combined allowance to avoid trading the body-read flake this replaced for a - // tighter timeout on a busy runner. - return responseFuture.toCompletionStage().toCompletableFuture().get(6, TimeUnit.SECONDS); + // Bound the complete request chain, including sending and reading the response body. + return responseFuture.toCompletionStage().toCompletableFuture().get(timeoutSeconds, TimeUnit.SECONDS); } private record HttpResponse(int statusCode, String body, Map headers) {}