fix: fetch actual agent/environment counts from server for tenant dashboard
All checks were successful
CI / build (push) Successful in 1m8s
CI / docker (push) Successful in 43s

The dashboard was showing hardcoded zeroes for agent and environment usage.
Now fetches real counts via M2M API from the tenant's server.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-10 20:35:24 +02:00
parent cab6e409b9
commit a5445e332e
5 changed files with 51 additions and 5 deletions

View File

@@ -104,6 +104,8 @@ class TenantPortalServiceTest {
when(tenantService.getById(tenantId)).thenReturn(Optional.of(tenant));
when(serverApiClient.getHealth("http://server:8080")).thenReturn(new ServerHealthResponse(true, "UP"));
when(serverApiClient.getAgentCount("http://server:8080")).thenReturn(3);
when(serverApiClient.getEnvironmentCount("http://server:8080")).thenReturn(1);
when(licenseService.getActiveLicense(tenantId)).thenReturn(Optional.of(license));
var result = tenantPortalService.getDashboard();
@@ -119,6 +121,8 @@ class TenantPortalServiceTest {
assertThat(result.licenseDaysRemaining()).isGreaterThanOrEqualTo(29);
assertThat(result.limits()).isNotEmpty();
assertThat(result.features()).isNotEmpty();
assertThat(result.agentCount()).isEqualTo(3);
assertThat(result.environmentCount()).isEqualTo(1);
}
@Test
@@ -136,6 +140,8 @@ class TenantPortalServiceTest {
assertThat(result.serverEndpoint()).isNull();
assertThat(result.licenseTier()).isNull();
assertThat(result.licenseDaysRemaining()).isZero();
assertThat(result.agentCount()).isZero();
assertThat(result.environmentCount()).isZero();
}
// --- getLicense tests ---