Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Change-Id: Ia94f703abf0cc0749e869917c5cff7c515b5708a
Signed-off-by: Yacov Manevich <[email protected]>
  • Loading branch information
yacovm committed Apr 18, 2022
1 parent 8020fe0 commit 058b330
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
33 changes: 10 additions & 23 deletions integration/raft/cft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")
})
})

Expand Down
6 changes: 6 additions & 0 deletions orderer/consensus/etcdraft/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package etcdraft
import (
"context"
"crypto/sha256"
"runtime/debug"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 058b330

Please sign in to comment.