fix: fetch actual agent/environment counts from server for tenant dashboard
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:
@@ -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 ---
|
||||
|
||||
Reference in New Issue
Block a user