diff --git a/cameleer-server-app/src/test/java/com/cameleer/server/app/alerting/eval/AlertEvaluatorJobIT.java b/cameleer-server-app/src/test/java/com/cameleer/server/app/alerting/eval/AlertEvaluatorJobIT.java index 5c78ec5e..9706fc08 100644 --- a/cameleer-server-app/src/test/java/com/cameleer/server/app/alerting/eval/AlertEvaluatorJobIT.java +++ b/cameleer-server-app/src/test/java/com/cameleer/server/app/alerting/eval/AlertEvaluatorJobIT.java @@ -54,6 +54,13 @@ class AlertEvaluatorJobIT extends AbstractPostgresIT { @BeforeEach void setup() { + // ClickHouse — purge any executions left over from prior tests in the + // shared CH instance. Matches the house-style used across the CH IT + // suite (see ClickHouseExecutionStoreIT, ClickHouseStatsStoreIT, etc.). + // TRUNCATE is synchronous, unlike ALTER ... DELETE (mutations_sync=0). + clickHouseJdbc.execute("TRUNCATE TABLE executions"); + clickHouseJdbc.execute("TRUNCATE TABLE processor_executions"); + // Default: empty registry — all evaluators return Clear when(agentRegistryService.findAll()).thenReturn(List.of()); @@ -91,13 +98,7 @@ class AlertEvaluatorJobIT extends AbstractPostgresIT { jdbcTemplate.update("DELETE FROM alert_rules WHERE environment_id = ?", envId); jdbcTemplate.update("DELETE FROM environments WHERE id = ?", envId); jdbcTemplate.update("DELETE FROM users WHERE user_id = ?", SYS_USER); - // ClickHouse — purge any executions seeded into this env. The shared CH instance - // persists across tests in the suite; scope the wipe to this test's env slug. - try { - if (envSlug != null) { - clickHouseJdbc.execute("ALTER TABLE executions DELETE WHERE environment = '" + envSlug + "'"); - } - } catch (Exception ignored) { /* best-effort; next setup uses a fresh env slug */ } + // ClickHouse `executions` is truncated in @BeforeEach (house style). } // -------------------------------------------------------------------------