Skip to content

Commit

Permalink
[FAB-13199] Reduce etcdraft test time.
Browse files Browse the repository at this point in the history
Change-Id: Idc65a77259ae7a153aa4d077f9e72d1e2961ab46
Signed-off-by: Jay Guo <guojiannan1101@gmail.com>
  • Loading branch information
guoger committed Dec 11, 2018
1 parent d03670b commit 658db4b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions orderer/consensus/etcdraft/chain_test.go
Expand Up @@ -1558,7 +1558,7 @@ var _ = Describe("Chain", func() {
Eventually(c4.support.WriteBlockCallCount, LongEventualTimeout).Should(Equal(2))

// node 1 has been stopped should not write any block
Consistently(c1.support.WriteBlockCallCount, defaultTimeout).Should(Equal(1))
Consistently(c1.support.WriteBlockCallCount).Should(Equal(1))

network.connect(1)

Expand Down Expand Up @@ -1689,7 +1689,7 @@ var _ = Describe("Chain", func() {
Eventually(c2.support.WriteBlockCallCount, LongEventualTimeout).Should(Equal(2))
Eventually(c3.support.WriteBlockCallCount, LongEventualTimeout).Should(Equal(2))
// node 1 has been removed from replica set should not be getting any blocks
Consistently(c1.support.WriteBlockCallCount, defaultTimeout).Should(Equal(1))
Consistently(c1.support.WriteBlockCallCount).Should(Equal(1))
})

It("removes leader from replica set", func() {
Expand Down Expand Up @@ -1729,17 +1729,17 @@ var _ = Describe("Chain", func() {
Eventually(c2.support.WriteBlockCallCount, LongEventualTimeout).Should(Equal(2))
Eventually(c3.support.WriteBlockCallCount, LongEventualTimeout).Should(Equal(2))
// node 1 has been stopped should not write any block
Consistently(c1.support.WriteBlockCallCount, defaultTimeout).Should(Equal(1))
Consistently(c1.support.WriteBlockCallCount).Should(Equal(1))

By("trying to submit to new node, expected to fail")
c1.cutter.CutNext = true
err = c1.Order(env, 0)
Expect(err).To(HaveOccurred())

// number of block writes should remain the same
Consistently(c2.support.WriteBlockCallCount, defaultTimeout).Should(Equal(2))
Consistently(c3.support.WriteBlockCallCount, defaultTimeout).Should(Equal(2))
Consistently(c1.support.WriteBlockCallCount, defaultTimeout).Should(Equal(1))
Consistently(c2.support.WriteBlockCallCount).Should(Equal(2))
Consistently(c3.support.WriteBlockCallCount).Should(Equal(2))
Consistently(c1.support.WriteBlockCallCount).Should(Equal(1))
})
})
})
Expand Down Expand Up @@ -2502,7 +2502,7 @@ func (n *network) start(ids ...uint64) {
_, err := n.chains[id].storage.Entries(1, 1, 1)
return err
}).ShouldNot(HaveOccurred())

Eventually(n.chains[id].WaitReady).ShouldNot(HaveOccurred())
wg.Done()
}(i)
}
Expand Down Expand Up @@ -2564,7 +2564,7 @@ func (n *network) elect(id uint64) (tick int) {
// results in undeterministic behavior. Therefore
// we are going to wait for enough time after each
// tick so it could take effect.
t := 1000 * time.Millisecond
t := 50 * time.Millisecond

n.connLock.RLock()
c := n.chains[id]
Expand All @@ -2585,7 +2585,7 @@ func (n *network) elect(id uint64) (tick int) {
// therefore, we might observe 0 first. In this
// situation, no more tick is needed because an
// leader election is already underway.
Eventually(c.observe).Should(Receive(Equal(id)))
Eventually(c.observe, LongEventualTimeout).Should(Receive(Equal(id)))
} else {
// if there's no leader (fresh cluster), we have 0 -> Y
// therefore we should observe Y directly.
Expand Down

0 comments on commit 658db4b

Please sign in to comment.