Search in sources :

Example 11 with StackGresDistributedLogsPostgresServices

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());
}
Also used : StackGresDistributedLogsPostgresServices(io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsPostgresServices) DistributedLogsPostgresServices(io.stackgres.apiweb.dto.distributedlogs.DistributedLogsPostgresServices) StackGresDistributedLogsPostgresServices(io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsPostgresServices) StackGresDistributedLogsPostgresServicesFixture(io.stackgres.apiweb.transformer.distributedlogs.converter.fixture.StackGresDistributedLogsPostgresServicesFixture) StackGresPostgresService(io.stackgres.common.crd.postgres.service.StackGresPostgresService) PostgresService(io.stackgres.apiweb.app.postgres.service.PostgresService) StackGresPostgresService(io.stackgres.common.crd.postgres.service.StackGresPostgresService) Test(org.junit.jupiter.api.Test)

Example 12 with StackGresDistributedLogsPostgresServices

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());
}
Also used : StackGresDistributedLogsPostgresServices(io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsPostgresServices) DistributedLogsPostgresServices(io.stackgres.apiweb.dto.distributedlogs.DistributedLogsPostgresServices) StackGresDistributedLogsPostgresServices(io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsPostgresServices) StackGresDistributedLogsPostgresServicesFixture(io.stackgres.apiweb.transformer.distributedlogs.converter.fixture.StackGresDistributedLogsPostgresServicesFixture) Test(org.junit.jupiter.api.Test)

Example 13 with StackGresDistributedLogsPostgresServices

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());
}
Also used : StackGresDistributedLogsPostgresServices(io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsPostgresServices) StackGresDistributedLogsPostgresServicesFixture(io.stackgres.apiweb.transformer.distributedlogs.converter.fixture.StackGresDistributedLogsPostgresServicesFixture) Test(org.junit.jupiter.api.Test)

Example 14 with StackGresDistributedLogsPostgresServices

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());
}
Also used : StackGresDistributedLogsPostgresServices(io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsPostgresServices) Test(org.junit.jupiter.api.Test)

Example 15 with StackGresDistributedLogsPostgresServices

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());
}
Also used : StackGresDistributedLogsPostgresServices(io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsPostgresServices) Test(org.junit.jupiter.api.Test)

Aggregations

StackGresDistributedLogsPostgresServices (io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsPostgresServices)16 Test (org.junit.jupiter.api.Test)14 StackGresDistributedLogsPostgresServicesFixture (io.stackgres.apiweb.transformer.distributedlogs.converter.fixture.StackGresDistributedLogsPostgresServicesFixture)6 DistributedLogsPostgresServices (io.stackgres.apiweb.dto.distributedlogs.DistributedLogsPostgresServices)3 StackGresPostgresService (io.stackgres.common.crd.postgres.service.StackGresPostgresService)3 PostgresService (io.stackgres.apiweb.app.postgres.service.PostgresService)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 JsonMapper (com.fasterxml.jackson.databind.json.JsonMapper)1 JsonPointer (com.github.fge.jackson.jsonpointer.JsonPointer)1 JsonPatchOperation (com.github.fge.jsonpatch.JsonPatchOperation)1 ImmutableList (com.google.common.collect.ImmutableList)1 StackGresPostgresServiceType (io.stackgres.common.crd.postgres.service.StackGresPostgresServiceType)1 CLUSTER_IP (io.stackgres.common.crd.postgres.service.StackGresPostgresServiceType.CLUSTER_IP)1 StackGresDistributedLogs (io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogs)1 StackGresDistributedLogsSpec (io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsSpec)1 StackGresDistributedLogsReview (io.stackgres.operator.common.StackGresDistributedLogsReview)1 AdmissionRequest (io.stackgres.operatorframework.admissionwebhook.AdmissionRequest)1 Operation (io.stackgres.operatorframework.admissionwebhook.Operation)1 List (java.util.List)1 Optional (java.util.Optional)1