Skip to content

Commit

Permalink
Use jc.DeepEquals instead of gc.DeepEquals
Browse files Browse the repository at this point in the history
Apparently, jc.DeepEquals gives better output in case of failed
comparisons.
  • Loading branch information
achilleasa committed Apr 8, 2019
1 parent cd388bb commit 46c837f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions apiserver/facades/agent/provisioner/provisioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1828,14 +1828,14 @@ func (s *withoutControllerSuite) TestMarkMachinesForRemoval(c *gc.C) {
results := res.Results
c.Assert(results, gc.HasLen, 6)
c.Check(results[0].Error, gc.IsNil)
c.Check(*results[1].Error, gc.DeepEquals,
c.Check(*results[1].Error, jc.DeepEquals,
*common.ServerError(errors.NotFoundf("machine 100")))
c.Check(*results[1].Error, jc.Satisfies, params.IsCodeNotFound)
c.Check(results[2].Error, gc.IsNil)
c.Check(*results[3].Error, gc.DeepEquals,
c.Check(*results[3].Error, jc.DeepEquals,
*common.ServerError(errors.New("cannot remove machine 1: machine is not dead")))
c.Check(*results[4].Error, gc.DeepEquals, *apiservertesting.ErrUnauthorized)
c.Check(*results[5].Error, gc.DeepEquals,
c.Check(*results[4].Error, jc.DeepEquals, *apiservertesting.ErrUnauthorized)
c.Check(*results[5].Error, jc.DeepEquals,
*common.ServerError(errors.New(`"application-thing" is not a valid machine tag`)))

removals, err := s.State.AllMachineRemovals()
Expand Down
8 changes: 4 additions & 4 deletions rpc/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,13 +572,13 @@ func (root *Root) assertServerNotified(c *gc.C, p testCallParams, requestId uint
c.Assert(serverReply.body, gc.Equals, stringVal{p.request().Action + " ret"})
}
if p.retErr && p.testErr {
c.Assert(serverReply.hdr, gc.DeepEquals, rpc.Header{
c.Assert(serverReply.hdr, jc.DeepEquals, rpc.Header{
RequestId: requestId,
Error: p.errorMessage(),
Version: 1,
})
} else {
c.Assert(serverReply.hdr, gc.DeepEquals, rpc.Header{
c.Assert(serverReply.hdr, jc.DeepEquals, rpc.Header{
RequestId: requestId,
Version: 1,
})
Expand Down Expand Up @@ -792,7 +792,7 @@ func (*rpcSuite) TestErrorInfo(c *gc.C) {
defer closeClient(c, client, srvDone)
err := client.Call(rpc.Request{"ErrorMethods", 0, "", "Call"}, nil, nil)
c.Assert(err, gc.ErrorMatches, `message`)
c.Assert(errors.Cause(err).(rpc.ErrorInfoProvider).ErrorInfo(), gc.DeepEquals, info)
c.Assert(errors.Cause(err).(rpc.ErrorInfoProvider).ErrorInfo(), jc.DeepEquals, info)
}

func (*rpcSuite) TestTransformErrors(c *gc.C) {
Expand Down Expand Up @@ -1287,7 +1287,7 @@ func (s *rpcSuite) TestRequestErrorInfoUnmarshaling(c *gc.C) {
err := re.UnmarshalInfo(spec.to)
if spec.err == "" {
c.Assert(err, gc.IsNil)
c.Assert(spec.to, gc.DeepEquals, spec.exp)
c.Assert(spec.to, jc.DeepEquals, spec.exp)
} else {
c.Assert(err, gc.ErrorMatches, spec.err)
}
Expand Down

0 comments on commit 46c837f

Please sign in to comment.