Search in sources :

Example 1 with ObjectMeta

use of com.marcnuri.yakc.model.io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta in project yakc by manusa.

the class NetworkingV1IngressIT method patchNamespacedIngress.

@Test
@DisplayName("patchNamespacedIngress, should patch labels of Ingress")
void patchNamespacedIngress() throws IOException {
    // Given
    final Ingress patch = Ingress.builder().metadata(ObjectMeta.builder().putInLabels("patched-label", "1337").build()).build();
    // When
    final Ingress result = KC.create(NetworkingV1Api.class).patchNamespacedIngress(ingressName, NAMESPACE, patch).get();
    // Then
    assertThat(result).isNotNull().extracting(Ingress::getMetadata).satisfies(m -> assertThat(m).extracting(ObjectMeta::getLabels).asInstanceOf(InstanceOfAssertFactories.MAP).hasSize(1).containsEntry("patched-label", "1337")).extracting(ObjectMeta::getResourceVersion).asString().isNotEmpty().isNotEqualTo(ingress.getMetadata().getResourceVersion());
}
Also used : ObjectMeta(com.marcnuri.yakc.model.io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta) Ingress(com.marcnuri.yakc.model.io.k8s.api.networking.v1.Ingress) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

Ingress (com.marcnuri.yakc.model.io.k8s.api.networking.v1.Ingress)1 ObjectMeta (com.marcnuri.yakc.model.io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta)1 DisplayName (org.junit.jupiter.api.DisplayName)1 Test (org.junit.jupiter.api.Test)1