Skip to content

Commit

Permalink
Adjust etcdraft error assertions for go 1.15 (#2276)
Browse files Browse the repository at this point in the history
Change-Id: Ia98d1c19d83a4cae578b0e35918b0e2cf9d9280c
Signed-off-by: Matthew Sykes <matthew.sykes@gmail.com>
  • Loading branch information
sykesm authored Jan 13, 2021
1 parent 00e644d commit 567614c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion orderer/consensus/etcdraft/consenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func (c *Consenter) HandleChain(support consensus.ConsenterSupport, metadata *co
} else {
tickInterval, err = time.ParseDuration(c.EtcdRaftConfig.TickIntervalOverride)
if err != nil {
return nil, errors.Errorf("failed parsing Consensus.TickIntervalOverride: %s: %v", c.EtcdRaftConfig.TickIntervalOverride, err)
return nil, errors.WithMessage(err, "failed parsing Consensus.TickIntervalOverride")
}
c.Logger.Infof("TickIntervalOverride is set, overriding channel configuration tick interval to %v", tickInterval)
}
Expand Down
3 changes: 2 additions & 1 deletion orderer/consensus/etcdraft/consenter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,8 @@ var _ = Describe("Consenter", func() {
consenter.EtcdRaftConfig.TickIntervalOverride = "seven"

_, err := consenter.HandleChain(support, nil)
Expect(err).To(MatchError("failed parsing Consensus.TickIntervalOverride: seven: time: invalid duration seven"))
Expect(err).To(MatchError(HavePrefix("failed parsing Consensus.TickIntervalOverride:")))
Expect(err).To(MatchError(ContainSubstring("seven")))
})
})

Expand Down

0 comments on commit 567614c

Please sign in to comment.