fix: update ITs to use consolidated init.sql, remove dead code
- All 7 ClickHouse integration tests now load init.sql via shared ClickHouseTestHelper instead of deleted V1-V11 migration files - Remove unused useScope exports (setApp, setRoute, setExchange, clearScope) - Remove unused CSS classes (monoCell, punchcardStack) - Update ui/README.md DS version to v0.1.28 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.cameleer3.server.app;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* Loads and executes the consolidated ClickHouse init.sql schema for integration tests.
|
||||
*/
|
||||
public final class ClickHouseTestHelper {
|
||||
|
||||
private ClickHouseTestHelper() {}
|
||||
|
||||
public static void executeInitSql(JdbcTemplate jdbc) throws IOException {
|
||||
String sql = new ClassPathResource("clickhouse/init.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
for (String statement : sql.split(";")) {
|
||||
String trimmed = statement.trim();
|
||||
String withoutComments = trimmed.lines()
|
||||
.filter(line -> !line.stripLeading().startsWith("--"))
|
||||
.map(String::trim)
|
||||
.filter(line -> !line.isEmpty())
|
||||
.reduce("", (a, b) -> a + b);
|
||||
if (!withoutComments.isEmpty()) {
|
||||
jdbc.execute(trimmed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import com.cameleer3.server.core.storage.LogEntryResult;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import com.cameleer3.server.app.ClickHouseTestHelper;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.testcontainers.clickhouse.ClickHouseContainer;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
@@ -39,9 +39,7 @@ class ClickHouseLogStoreIT {
|
||||
|
||||
jdbc = new JdbcTemplate(ds);
|
||||
|
||||
String ddl = new ClassPathResource("clickhouse/V8__logs.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
jdbc.execute(ddl);
|
||||
ClickHouseTestHelper.executeInitSql(jdbc);
|
||||
jdbc.execute("TRUNCATE TABLE logs");
|
||||
|
||||
store = new ClickHouseLogStore(jdbc);
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.cameleer3.common.model.FlatProcessorRecord;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import com.cameleer3.server.app.ClickHouseTestHelper;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.testcontainers.clickhouse.ClickHouseContainer;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
@@ -42,14 +42,7 @@ class ClickHouseSearchIndexIT {
|
||||
|
||||
jdbc = new JdbcTemplate(ds);
|
||||
|
||||
// Load DDL from classpath resources
|
||||
String executionsDdl = new ClassPathResource("clickhouse/V2__executions.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
String processorsDdl = new ClassPathResource("clickhouse/V3__processor_executions.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
|
||||
jdbc.execute(executionsDdl);
|
||||
jdbc.execute(processorsDdl);
|
||||
ClickHouseTestHelper.executeInitSql(jdbc);
|
||||
|
||||
jdbc.execute("TRUNCATE TABLE executions");
|
||||
jdbc.execute("TRUNCATE TABLE processor_executions");
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.cameleer3.server.core.agent.AgentEventRecord;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import com.cameleer3.server.app.ClickHouseTestHelper;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.testcontainers.clickhouse.ClickHouseContainer;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
@@ -36,12 +36,7 @@ class ClickHouseAgentEventRepositoryIT {
|
||||
|
||||
jdbc = new JdbcTemplate(ds);
|
||||
|
||||
String ddl = new ClassPathResource("clickhouse/V7__agent_events.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
jdbc.execute(ddl);
|
||||
// Apply identity column renames (subset of V9 migration)
|
||||
jdbc.execute("ALTER TABLE agent_events RENAME COLUMN agent_id TO instance_id");
|
||||
jdbc.execute("ALTER TABLE agent_events RENAME COLUMN app_id TO application_id");
|
||||
ClickHouseTestHelper.executeInitSql(jdbc);
|
||||
jdbc.execute("TRUNCATE TABLE agent_events");
|
||||
|
||||
repo = new ClickHouseAgentEventRepository(jdbc);
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.cameleer3.server.core.ingestion.TaggedDiagram;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import com.cameleer3.server.app.ClickHouseTestHelper;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.testcontainers.clickhouse.ClickHouseContainer;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
@@ -38,12 +38,7 @@ class ClickHouseDiagramStoreIT {
|
||||
|
||||
jdbc = new JdbcTemplate(ds);
|
||||
|
||||
String ddl = new ClassPathResource("clickhouse/V6__route_diagrams.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
jdbc.execute(ddl);
|
||||
// Apply identity column renames (subset of V9 migration)
|
||||
jdbc.execute("ALTER TABLE route_diagrams RENAME COLUMN agent_id TO instance_id");
|
||||
jdbc.execute("ALTER TABLE route_diagrams RENAME COLUMN application_name TO application_id");
|
||||
ClickHouseTestHelper.executeInitSql(jdbc);
|
||||
jdbc.execute("TRUNCATE TABLE route_diagrams");
|
||||
|
||||
store = new ClickHouseDiagramStore(jdbc);
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.cameleer3.server.core.storage.ExecutionStore.ProcessorRecord;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import com.cameleer3.server.app.ClickHouseTestHelper;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.testcontainers.clickhouse.ClickHouseContainer;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
@@ -42,22 +42,7 @@ class ClickHouseExecutionReadIT {
|
||||
ds.setPassword(clickhouse.getPassword());
|
||||
jdbc = new JdbcTemplate(ds);
|
||||
|
||||
// Load DDL for both tables
|
||||
String execDdl = new ClassPathResource("clickhouse/V2__executions.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
String procDdl = new ClassPathResource("clickhouse/V3__processor_executions.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
// Also load V5 for replay fields
|
||||
String replayDdl = new ClassPathResource("clickhouse/V5__replay_fields.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
|
||||
jdbc.execute(execDdl);
|
||||
jdbc.execute(procDdl);
|
||||
// V5 has ALTER TABLE statements — execute each separately
|
||||
for (String stmt : replayDdl.split(";")) {
|
||||
String trimmed = stmt.trim();
|
||||
if (!trimmed.isEmpty()) jdbc.execute(trimmed);
|
||||
}
|
||||
ClickHouseTestHelper.executeInitSql(jdbc);
|
||||
|
||||
jdbc.execute("TRUNCATE TABLE executions");
|
||||
jdbc.execute("TRUNCATE TABLE processor_executions");
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.cameleer3.common.model.FlatProcessorRecord;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import com.cameleer3.server.app.ClickHouseTestHelper;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.testcontainers.clickhouse.ClickHouseContainer;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
@@ -38,14 +38,7 @@ class ClickHouseExecutionStoreIT {
|
||||
|
||||
jdbc = new JdbcTemplate(ds);
|
||||
|
||||
// Load DDL from classpath resources
|
||||
String executionsDdl = new ClassPathResource("clickhouse/V2__executions.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
String processorsDdl = new ClassPathResource("clickhouse/V3__processor_executions.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
|
||||
jdbc.execute(executionsDdl);
|
||||
jdbc.execute(processorsDdl);
|
||||
ClickHouseTestHelper.executeInitSql(jdbc);
|
||||
|
||||
jdbc.execute("TRUNCATE TABLE executions");
|
||||
jdbc.execute("TRUNCATE TABLE processor_executions");
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.cameleer3.server.core.storage.StatsStore.PunchcardCell;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import com.cameleer3.server.app.ClickHouseTestHelper;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.testcontainers.clickhouse.ClickHouseContainer;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
@@ -43,48 +43,7 @@ class ClickHouseStatsStoreIT {
|
||||
|
||||
jdbc = new JdbcTemplate(ds);
|
||||
|
||||
// Load DDL from classpath resources (V2, V3, V4 create tables with old column names)
|
||||
String executionsDdl = new ClassPathResource("clickhouse/V2__executions.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
String processorsDdl = new ClassPathResource("clickhouse/V3__processor_executions.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
String statsDdl = new ClassPathResource("clickhouse/V4__stats_tables_and_mvs.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
String renameDdl = new ClassPathResource("clickhouse/V9__rename_identity_columns.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
|
||||
jdbc.execute(executionsDdl);
|
||||
jdbc.execute(processorsDdl);
|
||||
|
||||
// Drop MVs first (they reference the stats tables), then recreate everything
|
||||
jdbc.execute("DROP TABLE IF EXISTS stats_1m_all_mv");
|
||||
jdbc.execute("DROP TABLE IF EXISTS stats_1m_app_mv");
|
||||
jdbc.execute("DROP TABLE IF EXISTS stats_1m_route_mv");
|
||||
jdbc.execute("DROP TABLE IF EXISTS stats_1m_processor_mv");
|
||||
jdbc.execute("DROP TABLE IF EXISTS stats_1m_processor_detail_mv");
|
||||
jdbc.execute("DROP TABLE IF EXISTS stats_1m_all");
|
||||
jdbc.execute("DROP TABLE IF EXISTS stats_1m_app");
|
||||
jdbc.execute("DROP TABLE IF EXISTS stats_1m_route");
|
||||
jdbc.execute("DROP TABLE IF EXISTS stats_1m_processor");
|
||||
jdbc.execute("DROP TABLE IF EXISTS stats_1m_processor_detail");
|
||||
|
||||
// Create stats tables and MVs (using old column names from V4)
|
||||
String cleanedStatsDdl = statsDdl.replaceAll("--[^\n]*", "");
|
||||
for (String stmt : cleanedStatsDdl.split(";")) {
|
||||
String trimmed = stmt.trim();
|
||||
if (!trimmed.isEmpty()) {
|
||||
jdbc.execute(trimmed);
|
||||
}
|
||||
}
|
||||
|
||||
// Apply identity column renames (V9 migration)
|
||||
String cleanedRenameDdl = renameDdl.replaceAll("--[^\n]*", "");
|
||||
for (String stmt : cleanedRenameDdl.split(";")) {
|
||||
String trimmed = stmt.trim();
|
||||
if (!trimmed.isEmpty()) {
|
||||
jdbc.execute(trimmed);
|
||||
}
|
||||
}
|
||||
ClickHouseTestHelper.executeInitSql(jdbc);
|
||||
|
||||
// Truncate base tables
|
||||
jdbc.execute("TRUNCATE TABLE executions");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Cameleer3 UI
|
||||
|
||||
React SPA built with [@cameleer/design-system](https://gitea.siegeln.net/cameleer/design-system) v0.1.26, TanStack Query, and Zustand.
|
||||
React SPA built with [@cameleer/design-system](https://gitea.siegeln.net/cameleer/design-system) v0.1.28, TanStack Query, and Zustand.
|
||||
|
||||
## Development
|
||||
|
||||
|
||||
@@ -36,33 +36,5 @@ export function useScope() {
|
||||
navigate(parts.join('/'));
|
||||
}, [navigate, scope.appId, scope.routeId]);
|
||||
|
||||
const setApp = useCallback((appId: string | undefined) => {
|
||||
if (!appId) {
|
||||
navigate(`/${tab}`);
|
||||
} else {
|
||||
navigate(`/${tab}/${appId}`);
|
||||
}
|
||||
}, [navigate, tab]);
|
||||
|
||||
const setRoute = useCallback((appId: string, routeId: string | undefined) => {
|
||||
if (!routeId) {
|
||||
navigate(`/${tab}/${appId}`);
|
||||
} else {
|
||||
navigate(`/${tab}/${appId}/${routeId}`);
|
||||
}
|
||||
}, [navigate, tab]);
|
||||
|
||||
const setExchange = useCallback((appId: string, routeId: string, exchangeId: string | undefined) => {
|
||||
if (!exchangeId) {
|
||||
navigate(`/${tab}/${appId}/${routeId}`);
|
||||
} else {
|
||||
navigate(`/${tab}/${appId}/${routeId}/${exchangeId}`);
|
||||
}
|
||||
}, [navigate, tab]);
|
||||
|
||||
const clearScope = useCallback(() => {
|
||||
navigate(`/${tab}`);
|
||||
}, [navigate, tab]);
|
||||
|
||||
return { scope, setTab, setApp, setRoute, setExchange, clearScope };
|
||||
return { scope, setTab };
|
||||
}
|
||||
|
||||
@@ -77,13 +77,6 @@
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
/* Cells */
|
||||
.monoCell {
|
||||
font-size: 12px;
|
||||
font-family: var(--font-mono);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.appNameCell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -134,12 +127,6 @@
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.punchcardStack {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
/* Toggle button row */
|
||||
.toggleRow {
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user