use of io.stackgres.distributedlogs.common.StackGresDistributedLogsContext in project stackgres by ongres.
the class DistributedLogsClusterReconciliatorTest method testReconciliationWithRetentionUpdated_isPerformedWithoutUpdatingRetention.
@Test
void testReconciliationWithRetentionUpdated_isPerformedWithoutUpdatingRetention() 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");
databaseStatus.setRetention("1 minute");
distributedLogsContext.getDistributedLogs().getStatus().setDatabases(Seq.of(databaseStatus).toList());
Assertions.assertFalse(reconciliator.reconcile(null, distributedLogsContext).result().get());
verify(databaseReconciliator, times(1)).existsDatabase(any(), any());
verify(databaseReconciliator, times(1)).createDatabase(any(), any());
verify(databaseReconciliator, times(0)).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 testReconciliationWithEmptyStatus_isPerformed.
@Test
void testReconciliationWithEmptyStatus_isPerformed() throws Exception {
when(propertyContext.getString(same(DistributedLogsControllerProperty.DISTRIBUTEDLOGS_CONTROLLER_POD_NAME))).thenReturn("stackgres-0");
StackGresDistributedLogsContext distributedLogsContext = getDistributedLogsContext();
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 testReconciliationWithNonReadyPatroni_isSkipped.
@Test
void testReconciliationWithNonReadyPatroni_isSkipped() throws Exception {
when(propertyContext.getString(same(DistributedLogsControllerProperty.DISTRIBUTEDLOGS_CONTROLLER_POD_NAME))).thenReturn("stackgres-0");
StackGresDistributedLogsContext distributedLogsContext = getDistributedLogsContext();
Pod.class.cast(distributedLogsContext.getExistingResources().get(0).v1).getStatus().getContainerStatuses().get(0).setReady(false);
Assertions.assertFalse(reconciliator.reconcile(null, distributedLogsContext).result().get());
verify(databaseReconciliator, times(0)).existsDatabase(any(), any());
verify(databaseReconciliator, times(0)).createDatabase(any(), any());
verify(databaseReconciliator, times(0)).updateRetention(any(), any(), any(), any());
verify(databaseReconciliator, times(0)).reconcileRetention(any(), any(), any(), any());
}
use of io.stackgres.distributedlogs.common.StackGresDistributedLogsContext in project stackgres by ongres.
the class DistributedLogsClusterReconciliatorTest method testReconciliationWithDatabaseCreated_isPerformedWithoutDatabaseCreation.
@Test
void testReconciliationWithDatabaseCreated_isPerformedWithoutDatabaseCreation() throws Exception {
when(propertyContext.getString(same(DistributedLogsControllerProperty.DISTRIBUTEDLOGS_CONTROLLER_POD_NAME))).thenReturn("stackgres-0");
when(databaseReconciliator.existsDatabase(any(), any())).thenReturn(true);
StackGresDistributedLogsContext distributedLogsContext = getDistributedLogsContext();
Assertions.assertTrue(reconciliator.reconcile(null, distributedLogsContext).result().get());
verify(databaseReconciliator, times(1)).existsDatabase(any(), any());
verify(databaseReconciliator, times(0)).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 testReconciliationWithNullStatus_isSkipped.
@Test
void testReconciliationWithNullStatus_isSkipped() throws Exception {
StackGresDistributedLogsContext distributedLogsContext = getDistributedLogsContext();
distributedLogsContext.getDistributedLogs().setStatus(null);
Assertions.assertFalse(reconciliator.reconcile(null, distributedLogsContext).result().get());
verify(databaseReconciliator, times(0)).existsDatabase(any(), any());
verify(databaseReconciliator, times(0)).createDatabase(any(), any());
verify(databaseReconciliator, times(0)).updateRetention(any(), any(), any(), any());
verify(databaseReconciliator, times(0)).reconcileRetention(any(), any(), any(), any());
}
Aggregations