Skip to content

Commit 723a1f7

Browse files
committed
wip
Signed-off-by: wind57 <[email protected]>
1 parent 172f953 commit 723a1f7

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

spring-cloud-kubernetes-fabric8-leader/src/test/java/org/springframework/cloud/kubernetes/fabric8/leader/election/it/Fabric8LeaderElectionSimpleITTest.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ static void afterAll() {
7878
@Test
7979
void test(CapturedOutput output) {
8080

81+
// we have become the leader
82+
Awaitility.await()
83+
.atMost(Duration.ofSeconds(10))
84+
.pollInterval(Duration.ofSeconds(1))
85+
.until(() -> output.getOut().contains("simple-it is the new leader"));
86+
87+
// let's unwind some logs to see that the process is how we expect it to be
88+
8189
// 1. lease is used as the lock (comes from our code)
8290
assertThat(output.getOut()).contains(
8391
"will use lease as the lock for leader election");
@@ -91,13 +99,9 @@ void test(CapturedOutput output) {
9199
"Attempting to acquire leader lease 'LeaseLock: default - spring-k8s-leader-election-lock (simple-it)'");
92100

93101
// 4. we are the leader (comes from our code)
94-
assertThat(output.getOut()).contains("simple-it is now a leader");
102+
assertThat(output.getOut()).contains("Leader changed from null to simple-it");
103+
95104

96-
// wait for a renewal
97-
Awaitility.await()
98-
.pollInterval(Duration.ofSeconds(1))
99-
.atMost(Duration.ofMinutes(1))
100-
.until(() -> output.getOut().contains("Attempting to renew leader lease"));
101105

102106
// // all these logs happen before a renewal
103107
// Assertions.assertThat(output.getOut()).contains("starting leader initiator");
@@ -125,7 +129,9 @@ void test(CapturedOutput output) {
125129
// .withName("spring-k8s-leader-election-lock")
126130
// .get()
127131
// .getSpec()
128-
// .getRenewTime())));
132+
// .getRenewTime())))
133+
134+
129135
}
130136

131137
@TestConfiguration

0 commit comments

Comments
 (0)