use of com.marcnuri.yakc.model.io.k8s.api.core.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());
}
use of com.marcnuri.yakc.model.io.k8s.api.core.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);
}
use of com.marcnuri.yakc.model.io.k8s.api.core.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);
}
use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Service in project dekorate by dekorateio.
the class Issue586ScaleBoundsTest method shouldContainMinAndMaxBounds.
@Test
public void shouldContainMinAndMaxBounds() {
KubernetesList list = Serialization.unmarshalAsList(getClass().getClassLoader().getResourceAsStream("META-INF/dekorate/knative.yml"));
assertNotNull(list);
Service s = findFirst(list, Service.class).orElseThrow(() -> new IllegalStateException());
String minScale = s.getMetadata().getAnnotations().get("autoscaling.knative.dev/minScale");
String maxScale = s.getMetadata().getAnnotations().get("autoscaling.knative.dev/maxScale");
assertEquals("3", minScale);
assertEquals("5", maxScale);
}
Aggregations