Skip to content

Commit

Permalink
Add error checks to integration/{raft,sbe}
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
  • Loading branch information
sykesm authored and Brett Logan committed May 23, 2020
1 parent 4f3146e commit 88f19f9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
5 changes: 3 additions & 2 deletions integration/raft/cft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ var _ = Describe("EndToEnd Crash Fault Tolerance", func() {
Expect(denv).NotTo(BeNil())

block, err := nwo.Deliver(network, orderer, denv)
Expect(denv).NotTo(BeNil())
Expect(err).To(HaveOccurred())
Expect(block).To(BeNil())
Eventually(runner.Err(), time.Minute, time.Second).Should(gbytes.Say("client identity expired"))

Expand Down Expand Up @@ -581,7 +581,8 @@ func findLeader(ordererRunners []*ginkgomon.Runner) int {
Eventually(runner.Err(), time.Minute, time.Second).Should(gbytes.Say("Raft leader changed: [0-9] -> "))

idBuff := make([]byte, 1)
runner.Err().Read(idBuff)
_, err := runner.Err().Read(idBuff)
Expect(err).NotTo(HaveOccurred())

newLeader, err := strconv.ParseInt(string(idBuff), 10, 32)
Expect(err).To(BeNil())
Expand Down
12 changes: 8 additions & 4 deletions integration/raft/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ var _ = Describe("EndToEnd reconfiguration and onboarding", func() {
genesisBlock := pgen.GenesisBlockForChannel(network.SystemChannel.Name)
data, err := proto.Marshal(genesisBlock)
Expect(err).NotTo(HaveOccurred())
ioutil.WriteFile(network.OutputBlockPath(network.SystemChannel.Name), data, 0644)
err = ioutil.WriteFile(network.OutputBlockPath(network.SystemChannel.Name), data, 0644)
Expect(err).NotTo(HaveOccurred())

By("Starting orderer with malformed genesis block")
ordererRunner := network.OrdererGroupRunner()
Expand Down Expand Up @@ -194,7 +195,8 @@ var _ = Describe("EndToEnd reconfiguration and onboarding", func() {
Expect(err).NotTo(HaveOccurred())
data, err = proto.Marshal(configtx)
Expect(err).NotTo(HaveOccurred())
ioutil.WriteFile(network.CreateChannelTxPath(channel), data, 0644)
err = ioutil.WriteFile(network.CreateChannelTxPath(channel), data, 0644)
Expect(err).NotTo(HaveOccurred())

By("Submitting malformed channel creation config tx to orderer")
org1Peer0 := network.Peer("Org1", "peer0")
Expand Down Expand Up @@ -1412,10 +1414,12 @@ var _ = Describe("EndToEnd reconfiguration and onboarding", func() {

ordererOrg := updatedConfig.ChannelGroup.Groups["Orderer"].Groups["OrdererOrg"]
mspConfig := &msp.MSPConfig{}
proto.Unmarshal(ordererOrg.Values["MSP"].Value, mspConfig)
err := proto.Unmarshal(ordererOrg.Values["MSP"].Value, mspConfig)
Expect(err).NotTo(HaveOccurred())

fabMSPConfig := &msp.FabricMSPConfig{}
proto.Unmarshal(mspConfig.Config, fabMSPConfig)
err = proto.Unmarshal(mspConfig.Config, fabMSPConfig)
Expect(err).NotTo(HaveOccurred())

fabMSPConfig.Name = "OrdererMSP2"

Expand Down
7 changes: 5 additions & 2 deletions integration/sbe/sbe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ var _ = Describe("SBE_E2E", func() {
CollectionsConfig: "testdata/collection_config.json",
}

tempDir, err = ioutil.TempDir("", "nwo")
tempDir, err = ioutil.TempDir("", "sbe")
Expect(err).NotTo(HaveOccurred())
})

AfterEach(func() {
Expand All @@ -62,6 +63,7 @@ var _ = Describe("SBE_E2E", func() {
if network != nil {
network.Cleanup()
}
os.RemoveAll(tempDir)
os.RemoveAll(testDir)
})

Expand Down Expand Up @@ -443,7 +445,8 @@ func getLedgerHeight(n *nwo.Network, peer *nwo.Peer, channelName string) int {

channelInfoStr := strings.TrimPrefix(string(sess.Buffer().Contents()[:]), "Blockchain info:")
var channelInfo = common.BlockchainInfo{}
json.Unmarshal([]byte(channelInfoStr), &channelInfo)
err = json.Unmarshal([]byte(channelInfoStr), &channelInfo)
Expect(err).NotTo(HaveOccurred())
return int(channelInfo.Height)
}

Expand Down

0 comments on commit 88f19f9

Please sign in to comment.