-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestControllerTest.java
46 lines (37 loc) · 1.25 KB
/
TestControllerTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package de.donnerbart.operator;
import io.javaoperatorsdk.operator.Operator;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.kubernetes.client.KubernetesServerTestResource;
import jakarta.inject.Inject;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.assertj.core.api.Assertions.assertThat;
@QuarkusTest
@QuarkusTestResource(KubernetesServerTestResource.class)
class TestControllerTest {
private static final @NotNull Logger LOG = LoggerFactory.getLogger(TestControllerTest.class);
@Inject
protected @NotNull Operator operator;
@BeforeEach
void setUp() {
operator.start();
assertThat(operator.getRuntimeInfo().isStarted()).isTrue();
}
@AfterEach
void tearDown() {
operator.stop();
}
@Test
@Timeout(60)
void reconcile() {
final var client = operator.getKubernetesClient();
assertThat(client).isNotNull();
LOG.info("Test is running in namespace '{}'", client.getNamespace());
}
}