From 150c462cd0c61457a54dd8fe23f96e161b3b9d9f Mon Sep 17 00:00:00 2001 From: Marc Nuri Date: Wed, 26 Jun 2024 06:08:43 +0200 Subject: [PATCH] review: kubernetes-mock-server config Signed-off-by: Marc Nuri --- .../client/server/mock/KubernetesMockServer.java | 8 ++++---- .../server/mock/KubernetesMockServerExtensionTest.java | 10 +++++----- .../mock/OpenShiftMockServerExtensionStaticTests.java | 6 +++--- .../server/mock/OpenShiftMockServerExtensionTests.java | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/junit/kubernetes-server-mock/src/main/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServer.java b/junit/kubernetes-server-mock/src/main/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServer.java index a783a8a4b20..72d31aa3113 100644 --- a/junit/kubernetes-server-mock/src/main/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServer.java +++ b/junit/kubernetes-server-mock/src/main/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServer.java @@ -207,12 +207,12 @@ public void clearExpectations() { } protected Config initConfig() { - NamedContext mockServerContext = new NamedContextBuilder() - .withName("fabric8-mockserver-context") + final NamedContext mockServerContext = new NamedContextBuilder() + .withName("fabric8-mock-server-context") .withNewContext() .withNamespace("test") .withCluster(String.format("localhost:%d", getPort())) - .withUser("fabric8-mockserver-testuser") + .withUser("fabric8-mock-server-user") .endContext() .build(); return new ConfigBuilder(Config.empty()) @@ -223,7 +223,7 @@ protected Config initConfig() { .withHttp2Disable(true) .addToContexts(mockServerContext) .withCurrentContext(mockServerContext) - .withUsername("fabric8-mockserver-testuser") + .withUsername("fabric8-mock-server-user") .withOauthToken("secret") .build(); } diff --git a/junit/kubernetes-server-mock/src/test/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServerExtensionTest.java b/junit/kubernetes-server-mock/src/test/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServerExtensionTest.java index 50d6ed8be8c..a1f3554ac2d 100644 --- a/junit/kubernetes-server-mock/src/test/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServerExtensionTest.java +++ b/junit/kubernetes-server-mock/src/test/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServerExtensionTest.java @@ -29,22 +29,22 @@ class KubernetesMockServerExtensionTest { KubernetesClient client; @Test - void testExample() { + void mockServerConfiguration() { assertThat(client) .isNotNull() .extracting(Client::getConfiguration) .hasFieldOrPropertyWithValue("oauthToken", "secret") - .hasFieldOrPropertyWithValue("username", "fabric8-mockserver-testuser") - .hasFieldOrPropertyWithValue("currentContext.name", "fabric8-mockserver-context") + .hasFieldOrPropertyWithValue("username", "fabric8-mock-server-user") + .hasFieldOrPropertyWithValue("currentContext.name", "fabric8-mock-server-context") .hasFieldOrPropertyWithValue("currentContext.context.namespace", "test") - .hasFieldOrPropertyWithValue("currentContext.context.user", "fabric8-mockserver-testuser") + .hasFieldOrPropertyWithValue("currentContext.context.user", "fabric8-mock-server-user") .satisfies(c -> assertThat(c.getCurrentContext().getContext().getCluster()).startsWith("localhost:")) .satisfies(c -> assertThat(c.getContexts()).hasSize(1)); } @Test @DisplayName("KubernetesMockServerExtension uses KubernetesMixedDispatcher and provides expectation for GET /version") - void testGetKubernetesVersion() { + void getKubernetesVersion() { // When final VersionInfo result = client.getKubernetesVersion(); // Then diff --git a/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionStaticTests.java b/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionStaticTests.java index 867540a0497..09cd7d1e689 100644 --- a/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionStaticTests.java +++ b/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionStaticTests.java @@ -31,10 +31,10 @@ void testStaticOpenShiftClientGetsInitialized() { .isNotNull() .extracting(Client::getConfiguration) .hasFieldOrPropertyWithValue("oauthToken", "secret") - .hasFieldOrPropertyWithValue("username", "fabric8-mockserver-testuser") - .hasFieldOrPropertyWithValue("currentContext.name", "fabric8-mockserver-context") + .hasFieldOrPropertyWithValue("username", "fabric8-mock-server-user") + .hasFieldOrPropertyWithValue("currentContext.name", "fabric8-mock-server-context") .hasFieldOrPropertyWithValue("currentContext.context.namespace", "test") - .hasFieldOrPropertyWithValue("currentContext.context.user", "fabric8-mockserver-testuser") + .hasFieldOrPropertyWithValue("currentContext.context.user", "fabric8-mock-server-user") .satisfies(c -> assertThat(c.getCurrentContext().getContext().getCluster()).startsWith("localhost:")) .satisfies(c -> assertThat(c.getContexts()).hasSize(1)); } diff --git a/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionTests.java b/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionTests.java index 25d80d514a1..f4fa10f038d 100644 --- a/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionTests.java +++ b/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionTests.java @@ -31,10 +31,10 @@ void testOpenShiftClientGetsInitialized() { .isNotNull() .extracting(Client::getConfiguration) .hasFieldOrPropertyWithValue("oauthToken", "secret") - .hasFieldOrPropertyWithValue("username", "fabric8-mockserver-testuser") - .hasFieldOrPropertyWithValue("currentContext.name", "fabric8-mockserver-context") + .hasFieldOrPropertyWithValue("username", "fabric8-mock-server-user") + .hasFieldOrPropertyWithValue("currentContext.name", "fabric8-mock-server-context") .hasFieldOrPropertyWithValue("currentContext.context.namespace", "test") - .hasFieldOrPropertyWithValue("currentContext.context.user", "fabric8-mockserver-testuser") + .hasFieldOrPropertyWithValue("currentContext.context.user", "fabric8-mock-server-user") .satisfies(c -> assertThat(c.getCurrentContext().getContext().getCluster()).startsWith("localhost:")) .satisfies(c -> assertThat(c.getContexts()).hasSize(1)); }