-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45443 from manusa/fix/openshift-mock-server
Remove references to removed WithOpenShiftTestServer functionality
- Loading branch information
Showing
3 changed files
with
72 additions
and
30 deletions.
There are no files selected for viewing
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
48 changes: 48 additions & 0 deletions
48
...enshift-client/src/test/java/io/quarkus/it/openshift/client/KubernetesTestServerTest.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,48 @@ | ||
package io.quarkus.it.openshift.client; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.fabric8.kubernetes.client.KubernetesClient; | ||
import io.fabric8.kubernetes.client.dsl.NonDeletingOperation; | ||
import io.fabric8.kubernetes.client.server.mock.KubernetesServer; | ||
import io.fabric8.openshift.api.model.RouteBuilder; | ||
import io.fabric8.openshift.client.OpenShiftClient; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.quarkus.test.kubernetes.client.KubernetesTestServer; | ||
import io.quarkus.test.kubernetes.client.WithKubernetesTestServer; | ||
|
||
@WithKubernetesTestServer | ||
@QuarkusTest | ||
public class KubernetesTestServerTest { | ||
|
||
@KubernetesTestServer | ||
KubernetesServer mockServer; | ||
@Inject | ||
KubernetesClient kubernetesClient; | ||
@Inject | ||
OpenShiftClient openShiftClient; | ||
|
||
@Test | ||
public void clientsInjectedWithValidConfiguration() { | ||
assertThat(kubernetesClient) | ||
.isSameAs(openShiftClient) | ||
.extracting(c -> c.getConfiguration().getMasterUrl()) | ||
.isEqualTo(mockServer.getKubernetesMockServer().url("/")); | ||
} | ||
|
||
@Test | ||
public void openShiftClientInjectionWorks() throws InterruptedException { | ||
openShiftClient.routes().resource( | ||
new RouteBuilder() | ||
.withNewMetadata().withName("the-route").endMetadata() | ||
.withNewSpec().withHost("example.com").endSpec() | ||
.build()) | ||
.createOr(NonDeletingOperation::update); | ||
assertThat(mockServer.getLastRequest().getPath()) | ||
.isEqualTo("/apis/route.openshift.io/v1/namespaces/test/routes"); | ||
} | ||
} |
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