Search in sources :

Example 86 with Service

use of com.google.cloud.servicedirectory.v1.Service in project dekorate by dekorateio.

the class Issue572Test method shouldHaveMatchingPath.

@Test
public void shouldHaveMatchingPath() {
    KubernetesList list = Serialization.unmarshalAsList(getClass().getClassLoader().getResourceAsStream("META-INF/dekorate/knative.yml"));
    assertNotNull(list);
    Service s = findFirst(list, Service.class).orElseThrow(() -> new IllegalStateException());
    assertNotNull(s);
    assertEquals("cluster-local", s.getMetadata().getLabels().get("serving.knative.dev/visibility"));
}
Also used : Service(io.fabric8.knative.serving.v1.Service) KubernetesList(io.fabric8.kubernetes.api.model.KubernetesList) Test(org.junit.jupiter.api.Test)

Example 87 with Service

use of com.google.cloud.servicedirectory.v1.Service in project dekorate by dekorateio.

the class Issue442MultiPlatformTest method shouldHaveCustomGroupAndVersionInKnativeYml.

@Test
public void shouldHaveCustomGroupAndVersionInKnativeYml() {
    KubernetesList list = Serialization.unmarshalAsList(Issue442MultiPlatformTest.class.getClassLoader().getResourceAsStream("META-INF/dekorate/knative.yml"));
    assertNotNull(list);
    Service s = findFirst(list, Service.class).orElseThrow(() -> new IllegalStateException());
    assertNotNull(s);
    Map<String, String> labels = s.getMetadata().getLabels();
    assertNotNull(labels);
    assertEquals("kn-group", labels.get(Labels.PART_OF));
    assertEquals("1.0-knative", labels.get(Labels.VERSION));
}
Also used : Service(io.fabric8.knative.serving.v1.Service) Test(org.junit.jupiter.api.Test)

Example 88 with Service

use of com.google.cloud.servicedirectory.v1.Service in project dekorate by dekorateio.

the class Feat642TrafficSplittingTest method shouldContainRequestsPerSecond.

@Test
public void shouldContainRequestsPerSecond() {
    KubernetesList list = Serialization.unmarshalAsList(getClass().getClassLoader().getResourceAsStream("META-INF/dekorate/knative.yml"));
    assertNotNull(list);
    Service s = findFirst(list, Service.class).orElseThrow(() -> new IllegalStateException());
    assertNotNull(s);
    assertEquals(1, s.getSpec().getTraffic().size());
    TrafficTarget traffic = s.getSpec().getTraffic().get(0);
    assertEquals("my-revision", s.getSpec().getTemplate().getMetadata().getName());
    assertEquals("my-revision", traffic.getRevisionName());
    assertEquals((long) 80, traffic.getPercent());
    assertFalse(traffic.getLatestRevision());
}
Also used : Service(io.fabric8.knative.serving.v1.Service) KubernetesList(io.fabric8.kubernetes.api.model.KubernetesList) TrafficTarget(io.fabric8.knative.serving.v1.TrafficTarget) Test(org.junit.jupiter.api.Test)

Example 89 with Service

use of com.google.cloud.servicedirectory.v1.Service in project dekorate by dekorateio.

the class Feat575LocalAutoscalingTest method shouldContainRequestsPerSecond.

@Test
public void shouldContainRequestsPerSecond() {
    KubernetesList list = Serialization.unmarshalAsList(getClass().getClassLoader().getResourceAsStream("META-INF/dekorate/knative.yml"));
    assertNotNull(list);
    Service s = findFirst(list, Service.class).orElseThrow(() -> new IllegalStateException());
    String metric = s.getMetadata().getAnnotations().get("autoscaling.knative.dev/metric");
    assertEquals("rps", metric);
    String target = s.getMetadata().getAnnotations().get("autoscaling.knative.dev/target");
    assertEquals("100", target);
}
Also used : Service(io.fabric8.knative.serving.v1.Service) KubernetesList(io.fabric8.kubernetes.api.model.KubernetesList) Test(org.junit.jupiter.api.Test)

Example 90 with Service

use of com.google.cloud.servicedirectory.v1.Service in project dekorate by dekorateio.

the class Issue687KnativeVolumeTest method shouldHaveVolumesAndMounts.

@Test
public void shouldHaveVolumesAndMounts() {
    KubernetesList list = Serialization.unmarshalAsList(getClass().getClassLoader().getResourceAsStream("META-INF/dekorate/knative.yml"));
    assertNotNull(list);
    Service s = findFirst(list, Service.class).orElseThrow(() -> new IllegalStateException());
    assertNotNull(s);
    assertTrue(s.getSpec().getTemplate().getSpec().getVolumes().size() > 0);
    Container c = s.getSpec().getTemplate().getSpec().getContainers().get(0);
    assertNotNull(c);
    assertTrue(c.getVolumeMounts().size() > 0);
}
Also used : Container(io.fabric8.kubernetes.api.model.Container) Service(io.fabric8.knative.serving.v1.Service) KubernetesList(io.fabric8.kubernetes.api.model.KubernetesList) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)33 Service (io.fabric8.knative.serving.v1.Service)28 Connector (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector)22 Service (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service)22 Test (org.junit.Test)19 MockGrpcService (com.google.api.gax.grpc.testing.MockGrpcService)18 CoreException (org.eclipse.core.runtime.CoreException)18 Service (com.google.monitoring.v3.Service)16 IOException (java.io.IOException)15 AbstractMessage (com.google.protobuf.AbstractMessage)14 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)13 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)11 ProdBuildResults (io.quarkus.test.ProdBuildResults)11 ProdModeTestResults (io.quarkus.test.ProdModeTestResults)11 QuarkusProdModeTest (io.quarkus.test.QuarkusProdModeTest)11 Path (java.nio.file.Path)11 ArrayList (java.util.ArrayList)11 RegisterExtension (org.junit.jupiter.api.extension.RegisterExtension)11 List (java.util.List)10 DisplayName (org.junit.jupiter.api.DisplayName)10