feat: remove all ClickHouse dependencies from SaaS layer
- Delete log/ package (ClickHouseConfig, ContainerLogService, LogController) - Delete observability/ package (AgentStatusService, AgentStatusController) - Remove clickhouse-jdbc dependency from pom.xml - Remove cameleer.clickhouse config section from application.yml - Delete associated test files Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
package net.siegeln.cameleer.saas.log;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class ContainerLogServiceTest {
|
||||
|
||||
@Test
|
||||
void buffer_shouldAccumulateEntries() {
|
||||
var buffer = new ConcurrentLinkedQueue<String>();
|
||||
buffer.add("entry1");
|
||||
buffer.add("entry2");
|
||||
assertEquals(2, buffer.size());
|
||||
assertEquals("entry1", buffer.poll());
|
||||
assertEquals(1, buffer.size());
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
package net.siegeln.cameleer.saas.observability;
|
||||
|
||||
import net.siegeln.cameleer.saas.app.AppEntity;
|
||||
import net.siegeln.cameleer.saas.app.AppRepository;
|
||||
import net.siegeln.cameleer.saas.environment.EnvironmentEntity;
|
||||
import net.siegeln.cameleer.saas.environment.EnvironmentRepository;
|
||||
import net.siegeln.cameleer.saas.identity.ServerApiClient;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
import org.mockito.quality.Strictness;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@MockitoSettings(strictness = Strictness.LENIENT)
|
||||
class AgentStatusServiceTest {
|
||||
|
||||
@Mock private AppRepository appRepository;
|
||||
@Mock private EnvironmentRepository environmentRepository;
|
||||
@Mock private ServerApiClient serverApiClient;
|
||||
|
||||
private AgentStatusService agentStatusService;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
when(serverApiClient.isAvailable()).thenReturn(false);
|
||||
agentStatusService = new AgentStatusService(appRepository, environmentRepository, serverApiClient);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getAgentStatus_appNotFound_shouldThrow() {
|
||||
when(appRepository.findById(any())).thenReturn(Optional.empty());
|
||||
assertThrows(IllegalArgumentException.class,
|
||||
() -> agentStatusService.getAgentStatus(UUID.randomUUID()));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getAgentStatus_shouldReturnUnknownWhenServerUnreachable() {
|
||||
var appId = UUID.randomUUID();
|
||||
var envId = UUID.randomUUID();
|
||||
|
||||
var app = new AppEntity();
|
||||
app.setId(appId);
|
||||
app.setEnvironmentId(envId);
|
||||
app.setSlug("my-app");
|
||||
when(appRepository.findById(appId)).thenReturn(Optional.of(app));
|
||||
|
||||
var env = new EnvironmentEntity();
|
||||
env.setId(envId);
|
||||
env.setSlug("default");
|
||||
when(environmentRepository.findById(envId)).thenReturn(Optional.of(env));
|
||||
|
||||
// Server at localhost:9999 won't be running — should return UNKNOWN gracefully
|
||||
var result = agentStatusService.getAgentStatus(appId);
|
||||
|
||||
assertNotNull(result);
|
||||
assertFalse(result.registered());
|
||||
assertEquals("UNKNOWN", result.state());
|
||||
assertEquals("my-app", result.applicationId());
|
||||
assertEquals("default", result.environmentId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getObservabilityStatus_shouldReturnEmptyWhenClickHouseUnavailable() {
|
||||
var appId = UUID.randomUUID();
|
||||
var envId = UUID.randomUUID();
|
||||
|
||||
var app = new AppEntity();
|
||||
app.setId(appId);
|
||||
app.setEnvironmentId(envId);
|
||||
app.setSlug("my-app");
|
||||
when(appRepository.findById(appId)).thenReturn(Optional.of(app));
|
||||
|
||||
var env = new EnvironmentEntity();
|
||||
env.setId(envId);
|
||||
env.setSlug("default");
|
||||
when(environmentRepository.findById(envId)).thenReturn(Optional.of(env));
|
||||
|
||||
// No ClickHouse DataSource injected — should return empty status
|
||||
var result = agentStatusService.getObservabilityStatus(appId);
|
||||
|
||||
assertNotNull(result);
|
||||
assertFalse(result.hasTraces());
|
||||
assertEquals(0, result.traceCount24h());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user