diff --git a/cameleer-server-app/src/test/java/com/cameleer/server/app/controller/BackpressureIT.java b/cameleer-server-app/src/test/java/com/cameleer/server/app/controller/BackpressureIT.java index f67d2950..2c03c21a 100644 --- a/cameleer-server-app/src/test/java/com/cameleer/server/app/controller/BackpressureIT.java +++ b/cameleer-server-app/src/test/java/com/cameleer/server/app/controller/BackpressureIT.java @@ -22,9 +22,17 @@ import static org.assertj.core.api.Assertions.assertThat; * Only the metrics pipeline still uses a write buffer with backpressure. */ @TestPropertySource(properties = { - "ingestion.buffer-capacity=5", - "ingestion.batch-size=5", - "ingestion.flush-interval-ms=60000" // 60s -- effectively no flush during test + // Property keys must match the IngestionConfig @ConfigurationProperties + // prefix (cameleer.server.ingestion) exactly — the old "ingestion.*" + // form was silently ignored and the metrics buffer stayed at its + // default of 50_000, which made the 503 overflow scenario unreachable. + "cameleer.server.ingestion.buffercapacity=5", + "cameleer.server.ingestion.batchsize=5", + "cameleer.server.ingestion.flushintervalms=60000", + // MetricsFlushScheduler's @Scheduled reads ingestion.flush-interval-ms + // (a separate key) — override both so the test doesn't race against + // the default 1s flush during the fill-then-overflow scenario. + "ingestion.flush-interval-ms=60000" }) class BackpressureIT extends AbstractPostgresIT { @@ -81,7 +89,19 @@ class BackpressureIT extends AbstractPostgresIT { @Test void executionIngestion_isSynchronous_returnsAccepted() { String json = """ - {"routeId":"bp-sync","exchangeId":"bp-sync-e","status":"COMPLETED","startTime":"2026-03-11T10:00:00Z","durationMs":100,"processors":[]} + { + "exchangeId": "bp-sync-e", + "applicationId": "test-group", + "instanceId": "test-agent-backpressure-it", + "routeId": "bp-sync", + "status": "COMPLETED", + "startTime": "2026-03-11T10:00:00Z", + "endTime": "2026-03-11T10:00:00.100Z", + "durationMs": 100, + "chunkSeq": 0, + "final": true, + "processors": [] + } """; ResponseEntity response = restTemplate.postForEntity( diff --git a/cameleer-server-app/src/test/java/com/cameleer/server/app/controller/ForwardCompatIT.java b/cameleer-server-app/src/test/java/com/cameleer/server/app/controller/ForwardCompatIT.java index 9389916c..74b6f268 100644 --- a/cameleer-server-app/src/test/java/com/cameleer/server/app/controller/ForwardCompatIT.java +++ b/cameleer-server-app/src/test/java/com/cameleer/server/app/controller/ForwardCompatIT.java @@ -33,10 +33,26 @@ class ForwardCompatIT extends AbstractPostgresIT { @Test void unknownFieldsInRequestBodyDoNotCauseError() { + // Valid ExecutionChunk plus extra fields a future agent version + // might send. Jackson is configured with FAIL_ON_UNKNOWN_PROPERTIES + // = false on ChunkIngestionController, so the extras must be ignored + // and the envelope accepted with 202. String jsonWithUnknownFields = """ { - "futureField": "value", - "anotherUnknown": 42 + "exchangeId": "fwd-compat-1", + "applicationId": "test-group", + "instanceId": "test-agent-forward-compat-it", + "routeId": "fwd-compat-route", + "status": "COMPLETED", + "startTime": "2026-03-11T10:00:00Z", + "endTime": "2026-03-11T10:00:01Z", + "durationMs": 1000, + "chunkSeq": 0, + "final": true, + "processors": [], + "futureField": "value", + "anotherUnknown": 42, + "someNested": {"key": "v"} } """; diff --git a/cameleer-server-app/src/test/java/com/cameleer/server/app/interceptor/ProtocolVersionIT.java b/cameleer-server-app/src/test/java/com/cameleer/server/app/interceptor/ProtocolVersionIT.java index af2fc377..910a780c 100644 --- a/cameleer-server-app/src/test/java/com/cameleer/server/app/interceptor/ProtocolVersionIT.java +++ b/cameleer-server-app/src/test/java/com/cameleer/server/app/interceptor/ProtocolVersionIT.java @@ -65,7 +65,26 @@ class ProtocolVersionIT extends AbstractPostgresIT { headers.setContentType(MediaType.APPLICATION_JSON); headers.set("Authorization", "Bearer " + jwt); headers.set("X-Cameleer-Protocol-Version", "1"); - var entity = new HttpEntity<>("{}", headers); + // Minimal valid ExecutionChunk envelope so the controller can accept + // it; the prior {} body was treated by the chunk pipeline as an empty + // envelope and rejected with 400, which made the interceptor-passed + // signal ambiguous. + String chunk = """ + { + "exchangeId": "protocol-version-1", + "applicationId": "test-group", + "instanceId": "test-agent-protocol-it", + "routeId": "protocol-version-route", + "status": "COMPLETED", + "startTime": "2026-03-11T10:00:00Z", + "endTime": "2026-03-11T10:00:01Z", + "durationMs": 1, + "chunkSeq": 0, + "final": true, + "processors": [] + } + """; + var entity = new HttpEntity<>(chunk, headers); var response = restTemplate.exchange( "/api/v1/data/executions", HttpMethod.POST, entity, String.class);