From 058b330ae39414baab1146f244a8288d266bc319 Mon Sep 17 00:00:00 2001 From: Yacov Manevich Date: Mon, 18 Apr 2022 15:09:59 +0300 Subject: [PATCH] test Change-Id: Ia94f703abf0cc0749e869917c5cff7c515b5708a Signed-off-by: Yacov Manevich --- integration/raft/cft_test.go | 33 +++++++++--------------------- orderer/consensus/etcdraft/node.go | 6 ++++++ 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/integration/raft/cft_test.go b/integration/raft/cft_test.go index a42ab4f6f91..f48cd68e1bc 100644 --- a/integration/raft/cft_test.go +++ b/integration/raft/cft_test.go @@ -109,13 +109,16 @@ var _ = Describe("EndToEnd Crash Fault Tolerance", func() { findLeader([]*ginkgomon.Runner{o1Runner}) By("performing operation with orderer1") - env := CreateBroadcastEnvelope(network, o1, network.SystemChannel.Name, []byte("foo")) - resp, err := ordererclient.Broadcast(network, o1, env) - Expect(err).NotTo(HaveOccurred()) - Expect(resp.Status).To(Equal(common.Status_SUCCESS)) + for i := 1; i < 100; i++ { + env := CreateBroadcastEnvelope(network, o1, network.SystemChannel.Name, make([]byte, 1024 * 10)) + resp, err := ordererclient.Broadcast(network, o1, env) + Expect(err).NotTo(HaveOccurred()) + Expect(resp.Status).To(Equal(common.Status_SUCCESS)) + + block := FetchBlock(network, o1, uint64(i), network.SystemChannel.Name) + Expect(block).NotTo(BeNil()) + } - block := FetchBlock(network, o1, 1, network.SystemChannel.Name) - Expect(block).NotTo(BeNil()) By("killing orderer1") o1Proc.Signal(syscall.SIGKILL) @@ -124,29 +127,13 @@ var _ = Describe("EndToEnd Crash Fault Tolerance", func() { By("observing active nodes to shrink") Eventually(o2Runner.Err(), network.EventuallyTimeout).Should(gbytes.Say("Current active nodes in cluster are: \\[2 3\\]")) - By("broadcasting envelope to running orderer") - resp, err = ordererclient.Broadcast(network, o2, env) - Expect(err).NotTo(HaveOccurred()) - Expect(resp.Status).To(Equal(common.Status_SUCCESS)) - - block = FetchBlock(network, o2, 2, network.SystemChannel.Name) - Expect(block).NotTo(BeNil()) - By("restarting orderer1") o1Runner = network.OrdererRunner(o1) o1Proc = ifrit.Invoke(o1Runner) Eventually(o1Proc.Ready(), network.EventuallyTimeout).Should(BeClosed()) findLeader([]*ginkgomon.Runner{o1Runner}) - By("broadcasting envelope to restarted orderer") - resp, err = ordererclient.Broadcast(network, o1, env) - Expect(err).NotTo(HaveOccurred()) - Expect(resp.Status).To(Equal(common.Status_SUCCESS)) - - blko1 := FetchBlock(network, o1, 3, network.SystemChannel.Name) - blko2 := FetchBlock(network, o2, 3, network.SystemChannel.Name) - - Expect(blko1.Header.DataHash).To(Equal(blko2.Header.DataHash)) + Fail("bla") }) }) diff --git a/orderer/consensus/etcdraft/node.go b/orderer/consensus/etcdraft/node.go index ba6679f8147..a511f594ab0 100644 --- a/orderer/consensus/etcdraft/node.go +++ b/orderer/consensus/etcdraft/node.go @@ -9,6 +9,7 @@ package etcdraft import ( "context" "crypto/sha256" + "runtime/debug" "sync" "sync/atomic" "time" @@ -50,6 +51,11 @@ type node struct { raft.Node } +func (n *node) ApplyConfChange(cc raftpb.ConfChange) *raftpb.ConfState { + debug.PrintStack() + return n.Node.ApplyConfChange(cc) +} + func (n *node) start(fresh, join bool) { raftPeers := RaftPeers(n.metadata.ConsenterIds) n.logger.Debugf("Starting raft node: #peers: %v", len(raftPeers))