mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(ci): distribute slow classes sharing a test profile (#8511)
This commit is contained in:
1 parent
ac6f28a73b
commit
065d7194b0
3 files changed
+27
-13
No files matched your search
@@ -5,11 +5,13 @@ Usage: partition.sh <all-classes.txt> <shard-total> <shard-index>
|
||||
|
||||
<all-classes.txt> 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
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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<String, String> headers) {}
|
||||
|
||||
Reference in new issue
Block a user