Unverified Commit 06671310 authored by yacovm's avatar yacovm Committed by Artem Barger
Browse files

[FAB-13618] Fix test flake in OSN eviction test



The integration test that checks that an orderer is evicted from a channel
and stops its service for the channel has broken due to:

1) A removed log message that it used as an indicator was removed
   in a parallel CR.
2) In another parallel CR, the communication layer now puts message into
   the log asynchronously and doesn't block - and as a result -
   a node might be evicted from the channel but the other nodes will
   close the connection to it before it has a chance of obtaining the block
   that evicts it from the channel.

For (1) - the message that no longer exists was removed from the test.

For (2) - the node that is removed is now always the leader, and this way
          it always gets the block update (because it sends it in the first
          place).

Change-Id: Ib67d1a448447ef44d9b41f52c8ee8bddb6b064ce
Signed-off-by: default avataryacovm <yacovm@il.ibm.com>
parent e1b2171d
......@@ -375,33 +375,33 @@ var _ = Describe("EndToEnd reconfiguration and onboarding", func() {
}
By("Waiting for them to elect a leader")
findLeader(ordererRunners)
evictedNode := findLeader(ordererRunners) - 1
By("Creating a channel")
network.CreateChannel("testchannel", network.Orderers[0], peer)
network.CreateChannel("testchannel", network.Orderers[evictedNode], peer)
By("Waiting for the channel to be serviced")
assertBlockReception(map[string]int{
"testchannel": 0,
}, orderers, peer, network)
By("Removing the first orderer from both system channel and application channel")
By("Removing the leader from both system channel and application channel")
certificatesOfOrderers := refreshOrdererPEMs(network)
for _, channelName := range []string{"systemchannel", "testchannel"} {
nwo.RemoveConsenter(network, peer, network.Orderers[1], channelName, certificatesOfOrderers[0].oldCert)
}
nwo.RemoveConsenter(network, peer, network.Orderers[(evictedNode+1)%3], channelName, certificatesOfOrderers[evictedNode].oldCert)
By("Ensuring the other orderers disconnect from the evicted orderer")
Eventually(ordererRunners[1].Err(), time.Minute, time.Second).Should(gbytes.Say("Aborted connection to 1"))
Eventually(ordererRunners[2].Err(), time.Minute, time.Second).Should(gbytes.Say("Aborted connection to 1"))
fmt.Fprintln(GinkgoWriter, "Ensuring the other orderers detect the eviction of the node on channel", channelName)
Eventually(ordererRunners[(evictedNode+1)%3].Err(), time.Minute, time.Second).Should(gbytes.Say("Deactivated node"))
Eventually(ordererRunners[(evictedNode+2)%3].Err(), time.Minute, time.Second).Should(gbytes.Say("Deactivated node"))
By("Ensuring the evicted orderer stops rafting")
Eventually(ordererRunners[0].Err(), time.Minute, time.Second).Should(gbytes.Say("Raft node stopped channel=systemchannel"))
Eventually(ordererRunners[0].Err(), time.Minute, time.Second).Should(gbytes.Say("Raft node stopped channel=testchannel"))
fmt.Fprintln(GinkgoWriter, "Ensuring the evicted orderer stops rafting on channel", channelName)
stopMSg := fmt.Sprintf("Raft node stopped channel=%s", channelName)
Eventually(ordererRunners[evictedNode].Err(), time.Minute, time.Second).Should(gbytes.Say(stopMSg))
}
By("Ensuring the evicted orderer now doesn't serve clients")
ensureEvicted(orderers[0], peer, network, "systemchannel")
ensureEvicted(orderers[0], peer, network, "testchannel")
ensureEvicted(orderers[evictedNode], peer, network, "systemchannel")
ensureEvicted(orderers[evictedNode], peer, network, "testchannel")
By("Ensuring that all orderers don't log errors to the log")
assertNoErrorsAreLogged(ordererRunners)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment