forked from quarkus-qe/quarkus-test-suite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Verify, that grpc can be used for Openshift probes
See quarkusio/quarkus#32113 for details
- Loading branch information
Showing
2 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...elemetry-reactive/src/test/java/io/quarkus/ts/opentelemetry/reactive/OpenShiftGrpcIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package io.quarkus.ts.opentelemetry.reactive; | ||
|
||
import io.fabric8.kubernetes.api.model.Container; | ||
import io.fabric8.kubernetes.api.model.GRPCAction; | ||
import io.fabric8.kubernetes.api.model.Pod; | ||
import io.fabric8.kubernetes.api.model.Probe; | ||
import io.quarkus.test.bootstrap.inject.OpenShiftClient; | ||
import io.quarkus.test.scenarios.OpenShiftDeploymentStrategy; | ||
import io.quarkus.test.scenarios.OpenShiftScenario; | ||
import io.quarkus.test.scenarios.annotations.DisabledOnQuarkusVersion; | ||
import jakarta.inject.Inject; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.List; | ||
|
||
@OpenShiftScenario(deployment = OpenShiftDeploymentStrategy.UsingOpenShiftExtension) | ||
@DisabledOnQuarkusVersion(version = "2\\..*", reason = "GRPC probes are used only in Quarkus 3") | ||
public class OpenShiftGrpcIT extends OpenTelemetryGrpcIT { | ||
|
||
@Inject | ||
static OpenShiftClient oc; | ||
|
||
@Test | ||
void check() { | ||
List<Pod> pods = oc.podsInService(app); | ||
Assertions.assertEquals(1, pods.size()); | ||
List<Container> containers = pods.get(0).getSpec().getContainers(); | ||
Assertions.assertEquals(1, containers.size()); | ||
Container container = containers.get(0); | ||
validateProbe(container.getLivenessProbe()); | ||
validateProbe(container.getReadinessProbe()); | ||
} | ||
|
||
private static void validateProbe(Probe probe) { | ||
Assertions.assertNotNull(probe); | ||
GRPCAction grpcAction = probe.getGrpc(); | ||
Assertions.assertNotNull(grpcAction); | ||
Assertions.assertEquals("io.quarkus.example.PongService", grpcAction.getService()); | ||
Assertions.assertEquals(9000, grpcAction.getPort()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters