use of io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsPostgresServices in project stackgres by ongres.
the class DistributedLogsPostgresServicesConverterTest method shouldPgServiceReplicasBeConvertedSuccessfully_fromSgDistributedLogsPgServiceReplicas.
@Test
void shouldPgServiceReplicasBeConvertedSuccessfully_fromSgDistributedLogsPgServiceReplicas() {
StackGresDistributedLogsPostgresServices sgPostgresServices = new StackGresDistributedLogsPostgresServicesFixture().withReplicas().build();
DistributedLogsPostgresServices pgServicesConverted = converter.from(sgPostgresServices);
StackGresPostgresService sgPgReplicas = sgPostgresServices.getReplicas();
PostgresService dlPgReplicas = pgServicesConverted.getReplicas();
assertEquals(sgPgReplicas.getEnabled(), dlPgReplicas.getEnabled());
assertEquals(sgPgReplicas.getType(), dlPgReplicas.getType());
assertNull(pgServicesConverted.getPrimary());
}
use of io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsPostgresServices in project stackgres by ongres.
the class DistributedLogsPostgresServicesConverterTest method shouldPgServicesPrimaryAndReplicasBeNull_onceThereIsNoSgDistributedLogsPgServices.
@Test
void shouldPgServicesPrimaryAndReplicasBeNull_onceThereIsNoSgDistributedLogsPgServices() {
StackGresDistributedLogsPostgresServices sgPostgresServices = new StackGresDistributedLogsPostgresServicesFixture().build();
DistributedLogsPostgresServices pgServicesConverted = converter.from(sgPostgresServices);
assertNull(pgServicesConverted.getReplicas());
assertNull(pgServicesConverted.getPrimary());
}
use of io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsPostgresServices in project stackgres by ongres.
the class DistributedLogsPostgresServicesConverterTest method shouldTranslateDistributedLogsPostgresServices_toSgDLogsPgServicesWithOnlyReplicasInstace.
@Test
void shouldTranslateDistributedLogsPostgresServices_toSgDLogsPgServicesWithOnlyReplicasInstace() {
StackGresDistributedLogsPostgresServices postgresServices = converter.to(new DistributedLogsPostgresServicesFixture().withReplicas().build());
assertNull(postgresServices.getPrimary());
assertNotNull(postgresServices.getReplicas());
}
use of io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsPostgresServices in project stackgres by ongres.
the class DefaultPostgresServicesMutatorTest method clusterWithPostgresService_shouldSetNothing.
@Test
void clusterWithPostgresService_shouldSetNothing() {
setupDistributedLogsPgServices(withPgPrimaryService(TRUE, NODE_PORT.toString()), withPgReplicasService(TRUE, NODE_PORT.toString()));
StackGresDistributedLogsPostgresServices pgServicesMuted = mutate(review);
assertNull(pgServicesMuted.getPrimary().getEnabled());
assertEquals(sgDistributedLogs.getPrimary().getType(), pgServicesMuted.getPrimary().getType());
assertEquals(sgDistributedLogs.getReplicas().getEnabled(), pgServicesMuted.getReplicas().getEnabled());
assertEquals(sgDistributedLogs.getReplicas().getType(), pgServicesMuted.getReplicas().getType());
}
use of io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsPostgresServices in project stackgres by ongres.
the class DefaultPostgresServicesMutatorTest method clusterWithNoPgServicePrimary_shouldbeSetup.
@Test
void clusterWithNoPgServicePrimary_shouldbeSetup() {
setupDistributedLogsPgServices(withNoPgPrimaryService(), withPgReplicasService(FALSE, LOAD_BALANCER.toString()));
StackGresDistributedLogsPostgresServices pgServicesMuted = mutate(review);
assertNull(pgServicesMuted.getPrimary().getEnabled());
assertEquals(CLUSTER_IP.toString(), pgServicesMuted.getPrimary().getType());
assertEquals(Boolean.FALSE, pgServicesMuted.getReplicas().getEnabled());
assertEquals(LOAD_BALANCER.toString(), pgServicesMuted.getReplicas().getType());
}
Aggregations