fix: synchronize automation termination and stabilize headless tests
This commit is contained in:
@@ -9,8 +9,14 @@ import java.util.*;
|
||||
/** Deliberately adversarial child process. Never packaged into production. */
|
||||
public final class HeadlessFixture {
|
||||
static final ObjectMapper MAPPER = new ObjectMapper();
|
||||
// Allow normal JVM startup under load; call/cancel deadlines remain deliberately short.
|
||||
static final HeadlessLimits LIMITS = new HeadlessLimits(600, 4096, 4096, 5000, 500, 150);
|
||||
// Successful JVM/ImageIO startup and fragmented IO need headroom on CI. Only
|
||||
// fixtures that deliberately hang use short call or shutdown deadlines.
|
||||
static HeadlessLimits limits(String mode) {
|
||||
boolean hungCall = mode.equals("hang-call") || mode.equals("hang-cancel");
|
||||
boolean hungShutdown = hungCall || mode.equals("descendant");
|
||||
return new HeadlessLimits(600, 4096, 4096, 5000,
|
||||
hungCall ? 500 : 5000, hungShutdown ? 150 : 2000);
|
||||
}
|
||||
static String mode;
|
||||
static void emit(JsonNode value) throws Exception {
|
||||
byte[] bytes = (value.toString() + "\r\n").getBytes(java.nio.charset.StandardCharsets.UTF_8);
|
||||
@@ -30,7 +36,7 @@ public final class HeadlessFixture {
|
||||
var hello = MAPPER.createObjectNode().put("type", "hello").put("sessionId", "fixture").put("runtimeVersion", "fixture-only");
|
||||
hello.putObject("protocolVersion").put("major", mode.equals("major") ? 2 : 1).put("minor", 3);
|
||||
hello.set("capabilities", MAPPER.valueToTree(mode.equals("capabilities") ? Set.of("boot") : HeadlessWire.CAPABILITIES));
|
||||
hello.set("limits", MAPPER.valueToTree(LIMITS));
|
||||
hello.set("limits", MAPPER.valueToTree(limits(mode)));
|
||||
if (mode.equals("limits")) ((com.fasterxml.jackson.databind.node.ObjectNode) hello.path("limits")).put("maxFrames", 900);
|
||||
emit(hello);
|
||||
if (mode.equals("descendant")) {
|
||||
|
||||
Reference in New Issue
Block a user