use of io.stackgres.distributedlogs.common.StackGresDistributedLogsContext in project stackgres by ongres.
the class DistributedLogsClusterReconciliatorTest method testReconciliationWithEmptyDatabaseStatus_isPerformed.
@Test
void testReconciliationWithEmptyDatabaseStatus_isPerformed() throws Exception {
when(propertyContext.getString(same(DistributedLogsControllerProperty.DISTRIBUTEDLOGS_CONTROLLER_POD_NAME))).thenReturn("stackgres-0");
StackGresDistributedLogsContext distributedLogsContext = getDistributedLogsContext();
StackGresDistributedLogsStatusDatabase databaseStatus = new StackGresDistributedLogsStatusDatabase();
databaseStatus.setName("stackgres_stackgres");
distributedLogsContext.getDistributedLogs().getStatus().setDatabases(Seq.of(databaseStatus).toList());
Assertions.assertTrue(reconciliator.reconcile(null, distributedLogsContext).result().get());
verify(databaseReconciliator, times(1)).existsDatabase(any(), any());
verify(databaseReconciliator, times(1)).createDatabase(any(), any());
verify(databaseReconciliator, times(2)).updateRetention(any(), any(), any(), any());
verify(databaseReconciliator, times(2)).reconcileRetention(any(), any(), any(), any());
}
use of io.stackgres.distributedlogs.common.StackGresDistributedLogsContext in project stackgres by ongres.
the class DistributedLogsClusterReconciliatorTest method testReconciliationWithoutRetention_isPerformed.
@Test
void testReconciliationWithoutRetention_isPerformed() throws Exception {
when(propertyContext.getString(same(DistributedLogsControllerProperty.DISTRIBUTEDLOGS_CONTROLLER_POD_NAME))).thenReturn("stackgres-0");
StackGresDistributedLogsContext distributedLogsContext = getDistributedLogsContext();
distributedLogsContext.getDistributedLogs().getStatus().getConnectedClusters().get(0).getConfig().setRetention(null);
Assertions.assertTrue(reconciliator.reconcile(null, distributedLogsContext).result().get());
verify(databaseReconciliator, times(1)).existsDatabase(any(), any());
verify(databaseReconciliator, times(1)).createDatabase(any(), any());
verify(databaseReconciliator, times(2)).updateRetention(any(), any(), any(), any());
verify(databaseReconciliator, times(0)).reconcileRetention(any(), any(), any(), any());
}
Aggregations