Skip to content

Commit

Permalink
✅ k8s: Fix test unit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vignaudo committed Jul 15, 2024
1 parent ef983dc commit 345e2c8
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;

import java.io.IOException;
Expand Down Expand Up @@ -54,6 +55,8 @@
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.NamespaceableResource;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.x_k8s.cluster.v1beta1.Cluster;
import io.x_k8s.cluster.v1beta1.ClusterStatus;

@ExtendWith(MockitoExtension.class)
class OsClusterServiceTest {
Expand Down Expand Up @@ -122,6 +125,11 @@ void testCreateCluster() {
.build())
.build())
.build();
when(client.resource((HasMetadata) any())).thenReturn(namespaceRes);
final Cluster cluster = Mockito.mock(Cluster.class);
when(namespaceRes.get()).thenReturn(cluster);
final ClusterStatus clusterStatus = Mockito.mock(ClusterStatus.class);
when(cluster.getStatus()).thenReturn(clusterStatus);
srv.createCluster(vci, k8sConfigMock, params);
assertTrue(true);
}
Expand Down

0 comments on commit 345e2c8

Please sign in to comment.