Skip to content

Commit d63639f

Browse files
committed
Merge remote-tracking branch 'origin/develop' into watch-fix-old
2 parents 7014054 + d4830ff commit d63639f

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

operator/pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,11 @@
338338
<artifactId>simplestub</artifactId>
339339
<scope>test</scope>
340340
</dependency>
341-
341+
<dependency>
342+
<groupId>com.google.code.tempus-fugit</groupId>
343+
<artifactId>tempus-fugit</artifactId>
344+
<version>1.1</version>
345+
</dependency>
342346
</dependencies>
343347

344348
</project>

operator/src/test/java/oracle/kubernetes/operator/helpers/ServerKubernetesObjectsLookupTest.java

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import static org.hamcrest.Matchers.sameInstance;
1212
import static org.hamcrest.junit.MatcherAssert.assertThat;
1313

14+
import com.google.code.tempusfugit.concurrency.IntermittentTestRunner;
15+
import com.google.code.tempusfugit.concurrency.annotations.Intermittent;
1416
import com.meterware.simplestub.Memento;
1517
import com.meterware.simplestub.StaticStubSupport;
1618
import io.kubernetes.client.models.V1ObjectMeta;
@@ -23,32 +25,35 @@
2325
import oracle.kubernetes.weblogic.domain.v2.DomainSpec;
2426
import org.junit.After;
2527
import org.junit.Before;
26-
import org.junit.Ignore;
2728
import org.junit.Rule;
2829
import org.junit.Test;
2930
import org.junit.rules.TestWatcher;
3031
import org.junit.runner.Description;
32+
import org.junit.runner.RunWith;
3133

34+
@RunWith(IntermittentTestRunner.class)
3235
public class ServerKubernetesObjectsLookupTest {
3336

3437
private List<Memento> mementos = new ArrayList<>();
3538

39+
private String retryLegalName;
40+
private ServerKubernetesObjects retryInstance;
41+
3642
@Rule
3743
public TestWatcher watcher =
3844
new TestWatcher() {
3945
@Override
4046
protected void failed(Throwable e, Description description) {
4147
super.failed(e, description);
4248
System.out.println("Tell Russell\n" + DomainPresenceMonitor.getExplanation());
43-
try {
44-
Memento serverMap =
45-
StaticStubSupport.preserve(ServerKubernetesObjectsManager.class, "serverMap");
46-
Map<String, ServerKubernetesObjects> map = serverMap.getOriginalValue();
47-
System.out.println(" internal: " + map);
48-
System.out.println(
49-
" returned: " + ServerKubernetesObjectsManager.getServerKubernetesObjects());
50-
} catch (NoSuchFieldException ignored) {
51-
}
49+
Map<String, ServerKubernetesObjects> returnedMap =
50+
ServerKubernetesObjectsManager.getServerKubernetesObjects();
51+
52+
System.out.printf(
53+
"\nObject in map with key %s is %s, which compares %b",
54+
retryLegalName,
55+
returnedMap.get(retryLegalName),
56+
retryInstance == returnedMap.get(retryLegalName));
5257
}
5358
};
5459

@@ -82,7 +87,7 @@ public void whenNoPreexistingDomains_createEmptyServerKubernetesObjectsMap() {
8287
}
8388

8489
@Test
85-
@Ignore
90+
@Intermittent(repetition = 10)
8691
public void whenK8sHasDomainWithOneServer_canLookupFromServerKubernetesObjectsFactory() {
8792
Domain domain = createDomain("UID1", "ns1");
8893
DomainPresenceInfo info = DomainPresenceInfoManager.getOrCreate(domain);
@@ -91,6 +96,8 @@ public void whenK8sHasDomainWithOneServer_canLookupFromServerKubernetesObjectsFa
9196

9297
assertThat(info.getServers(), hasEntry(equalTo("admin"), sameInstance(sko)));
9398

99+
retryLegalName = LegalNames.toServerName("UID1", "admin");
100+
retryInstance = sko;
94101
assertThat(
95102
ServerKubernetesObjectsManager.getServerKubernetesObjects(),
96103
hasEntry(equalTo(LegalNames.toServerName("UID1", "admin")), sameInstance(sko)));

0 commit comments

Comments
 (0)