use of com.marcnuri.yakc.model.io.k8s.api.core.v1.PodSpec in project yakc by manusa.
the class PodIT method replaceNamespacedPod.
@Test
@DisplayName("replaceNamespacedPod, should replace existing Pod's image")
void replaceNamespacedPod() throws IOException {
// Given
awaitPodReady();
final Pod existingPod = KC.create(CoreV1Api.class).readNamespacedPod(podName, NAMESPACE).get();
existingPod.getMetadata().setResourceVersion(null);
existingPod.getSpec().getContainers().get(0).setImage("nginxdemos/hello");
// When
final Pod result = KC.create(CoreV1Api.class).replaceNamespacedPod(podName, NAMESPACE, existingPod).get();
// Then
assertThat(result).isNotNull().hasFieldOrPropertyWithValue("metadata.name", podName).extracting(Pod::getSpec).extracting(PodSpec::getContainers).asList().hasSize(1).element(0).hasFieldOrPropertyWithValue("image", "nginxdemos/hello");
}
Aggregations