use of com.marcnuri.yakc.model.io.k8s.api.core.v1.ServiceSpec in project yakc by manusa.
the class ServiceLegacyIT method replaceNamespacedService.
@Test
@DisplayName("replaceNamespacedService, should replace existing Service's port")
void replaceNamespacedService() throws IOException {
// Given
final Service existingService = KC.create(CoreV1Api.class).readNamespacedService(serviceName, NAMESPACE).get();
existingService.getSpec().getPorts().get(0).setTargetPort("http");
// When
final Service result = KC.create(CoreV1Api.class).replaceNamespacedService(serviceName, NAMESPACE, existingService).get();
// Then
assertThat(result).isNotNull().hasFieldOrPropertyWithValue("metadata.name", serviceName).extracting(Service::getSpec).extracting(ServiceSpec::getPorts).asList().hasSize(2).element(0).hasFieldOrPropertyWithValue("targetPort", "http");
}
use of com.marcnuri.yakc.model.io.k8s.api.core.v1.ServiceSpec in project yakc by manusa.
the class ServiceIT method replaceNamespacedService.
@Test
@DisplayName("replaceNamespacedService, should replace existing Service's port")
void replaceNamespacedService() throws IOException {
// Given
final Service existingService = KC.create(CoreV1Api.class).readNamespacedService(serviceName, NAMESPACE).get();
existingService.getSpec().getPorts().get(0).setTargetPort("http");
// When
final Service result = KC.create(CoreV1Api.class).replaceNamespacedService(serviceName, NAMESPACE, existingService).get();
// Then
assertThat(result).isNotNull().hasFieldOrPropertyWithValue("metadata.name", serviceName).extracting(Service::getSpec).extracting(ServiceSpec::getPorts).asList().hasSize(2).element(0).hasFieldOrPropertyWithValue("targetPort", "http");
}
Aggregations