Skip to content

Commit

Permalink
test: remove unneeded KubernetesMockServer.createClient() calls
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa authored Oct 22, 2024
1 parent c2fcc35 commit da8d358
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

class MixedCrudTest {

KubernetesMockServer server;
private KubernetesMockServer server;
private KubernetesClient client;

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import io.fabric8.kubernetes.api.model.PodListBuilder;
import io.fabric8.kubernetes.api.model.WatchEvent;
import io.fabric8.kubernetes.api.model.policy.v1.EvictionBuilder;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClientException;
import io.fabric8.kubernetes.client.LocalPortForward;
import io.fabric8.kubernetes.client.NamespacedKubernetesClient;
import io.fabric8.kubernetes.client.PortForward;
import io.fabric8.kubernetes.client.Watch;
import io.fabric8.kubernetes.client.Watcher;
Expand Down Expand Up @@ -83,15 +83,14 @@
class PodTest {

KubernetesMockServer server;
NamespacedKubernetesClient client;

@TempDir
Path tempDir;

private KubernetesClient client;

@BeforeEach
void setUp() {
client = server.createClient().inNamespace("test");
client = client.inNamespace("test");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import io.fabric8.openshift.api.model.GroupList;
import io.fabric8.openshift.api.model.GroupListBuilder;
import io.fabric8.openshift.client.NamespacedOpenShiftClient;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -39,11 +38,6 @@ class GroupTest {
KubernetesMockServer server;
NamespacedOpenShiftClient client;

@BeforeEach
void setUp() {
client = server.createClient().adapt(NamespacedOpenShiftClient.class);
}

@Test
void testList() {
server.expect().withPath("/apis/user.openshift.io/v1/groups").andReturn(200, new GroupListBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import io.fabric8.openshift.api.model.SubjectRulesReview;
import io.fabric8.openshift.api.model.SubjectRulesReviewBuilder;
import io.fabric8.openshift.client.NamespacedOpenShiftClient;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static java.net.HttpURLConnection.HTTP_CREATED;
Expand All @@ -44,11 +43,6 @@ class SubjectAccessReviewTest {
KubernetesMockServer server;
NamespacedOpenShiftClient client;

@BeforeEach
void setUp() {
client = server.createClient().adapt(NamespacedOpenShiftClient.class);
}

@Test
void testCreate() {
server.expect().withPath("/apis/authorization.openshift.io/v1/subjectaccessreviews")
Expand Down

0 comments on commit da8d358

Please sign in to comment.