Skip to content

Commit 597b50d

Browse files
committed
Add test for code coverage
1 parent 0f7b96c commit 597b50d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

internal/mode/static/health_test.go

+15
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,18 @@ func TestReadyCheck(t *testing.T) {
2323
healthChecker.ready = true
2424
g.Expect(healthChecker.readyCheck(nil)).To(Succeed())
2525
}
26+
27+
func TestSetAsLeader(t *testing.T) {
28+
t.Parallel()
29+
g := NewWithT(t)
30+
healthChecker := newGraphBuiltHealthChecker()
31+
healthChecker.eventCh = make(chan interface{}, 1)
32+
33+
g.Expect(healthChecker.leader).To(BeFalse())
34+
g.Expect(healthChecker.eventCh).ShouldNot(Receive())
35+
36+
healthChecker.setAsLeader()
37+
38+
g.Expect(healthChecker.leader).To(BeTrue())
39+
g.Expect(healthChecker.eventCh).Should(Receive())
40+
}

0 commit comments

Comments
 (0)