Skip to content

Commit 93ea12f

Browse files
committed
[FAB-13350] Fix etcdraft flaky test
Change-Id: Icd364101a350ab6fa2959f196f346c717a16337f Signed-off-by: Jay Guo <guojiannan1101@gmail.com>
1 parent 7d0a5a1 commit 93ea12f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

orderer/consensus/etcdraft/chain_test.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,15 +1671,18 @@ var _ = Describe("Chain", func() {
16711671
err := c1.Configure(configEnv, 0)
16721672
Expect(err).ToNot(HaveOccurred())
16731673

1674-
// every node has written config block to the OSN ledger
1675-
network.exec(
1676-
func(c *chain) {
1677-
Eventually(c.support.WriteConfigBlockCallCount, LongEventualTimeout).Should(Equal(1))
1678-
})
1674+
Eventually(c1.support.WriteConfigBlockCallCount, LongEventualTimeout).Should(Equal(1))
1675+
// Defer assertions on c2&c3 after c2 being elected because we may disconnect c1 too
1676+
// quickly, and the MsgApps it sends to c2/c3 are dropped. Therefore, this config block
1677+
// on c2/c3 has not been committed yet. After c2 being elected, new leader will continue
1678+
// the effort to commit config block, if it's not done yet.
16791679

16801680
// electing new leader
16811681
network.elect(2)
16821682

1683+
Eventually(c2.support.WriteConfigBlockCallCount, LongEventualTimeout).Should(Equal(1))
1684+
Eventually(c3.support.WriteConfigBlockCallCount, LongEventualTimeout).Should(Equal(1))
1685+
16831686
By("submitting new transaction to follower")
16841687
c2.cutter.CutNext = true
16851688
err = c3.Order(env, 0)

0 commit comments

Comments
 (0)