Skip to content

Commit

Permalink
TestPromiseOrdering: use require, not assert.
Browse files Browse the repository at this point in the history
...the latter often just results in me staring at cascading errors,
which is unhelpful.
  • Loading branch information
zenhack committed Jun 20, 2023
1 parent 0d80d1f commit f103d94
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions rpc/senderpromise_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"capnproto.org/go/capnp/v3/rpc/transport"
rpccp "capnproto.org/go/capnp/v3/std/capnp/rpc"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestSenderPromiseFulfill(t *testing.T) {
Expand Down Expand Up @@ -402,14 +403,14 @@ func TestPromiseOrdering(t *testing.T) {
// Verify that all the results are as expected. The server
// Will verify that they came in the right order.
res, err := fut.Struct()
assert.NoError(t, err, fmt.Sprintf("call #%d should succeed", i))
assert.Equal(t, int64(i), res.N())
require.NoError(t, err, fmt.Sprintf("call #%d should succeed", i))
require.Equal(t, int64(i), res.N())
}
for _, rel := range rels {
rel()
}

assert.NoError(t, remotePromise.Resolve(ctx))
require.NoError(t, remotePromise.Resolve(ctx))
// Shut down the connections, and make sure we can still send
// calls. This ensures that we've successfully shortened the path to
// cut out the remote peer:
Expand All @@ -418,6 +419,6 @@ func TestPromiseOrdering(t *testing.T) {
fut, rel := echoNum(ctx, remotePromise, int64(numCalls))
defer rel()
res, err := fut.Struct()
assert.NoError(t, err)
assert.Equal(t, int64(numCalls), res.N())
require.NoError(t, err)
require.Equal(t, int64(numCalls), res.N())
}

0 comments on commit f103d94

Please sign in to comment.