Skip to content

Commit

Permalink
review: kubernetes-mock-server config
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa committed Jun 26, 2024
1 parent 9b29217 commit 150c462
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit 150c462

Please sign in to comment.