@@ -149,7 +149,7 @@ func (s *ClientInterceptorTestSuite) SetupSuite() {
149
149
s .mock = & mockReportable {}
150
150
151
151
s .serverListener , err = net .Listen ("tcp" , "127.0.0.1:0" )
152
- require . NoError ( s . T (), err , "must be able to allocate a port for serverListener" )
152
+ s . Require (). NoError ( err , "must be able to allocate a port for serverListener" )
153
153
154
154
s .server = grpc .NewServer ()
155
155
testpb .RegisterTestServiceServer (s .server , & testpb.TestPingService {})
@@ -166,7 +166,7 @@ func (s *ClientInterceptorTestSuite) SetupSuite() {
166
166
grpc .WithUnaryInterceptor (UnaryClientInterceptor (s .mock )),
167
167
grpc .WithStreamInterceptor (StreamClientInterceptor (s .mock )),
168
168
)
169
- require . NoError ( s . T (), err , "must not error on client Dial" )
169
+ s . Require (). NoError ( err , "must not error on client Dial" )
170
170
s .testClient = testpb .NewTestServiceClient (s .clientConn )
171
171
}
172
172
@@ -200,7 +200,7 @@ func (s *ClientInterceptorTestSuite) TearDownTest() {
200
200
201
201
func (s * ClientInterceptorTestSuite ) TestUnaryReporting () {
202
202
_ , err := s .testClient .PingEmpty (s .ctx , & testpb.PingEmptyRequest {}) // should return with code=OK
203
- require . NoError ( s . T (), err )
203
+ s . Require (). NoError ( err )
204
204
s .mock .Equal (s .T (), []* mockReport {{
205
205
CallMeta : CallMeta {Typ : Unary , Service : testpb .TestServiceFullName , Method : "PingEmpty" },
206
206
postCalls : []error {nil },
@@ -210,7 +210,7 @@ func (s *ClientInterceptorTestSuite) TestUnaryReporting() {
210
210
s .mock .reports = s .mock .reports [:0 ] // Reset.
211
211
212
212
_ , err = s .testClient .PingError (s .ctx , & testpb.PingErrorRequest {ErrorCodeReturned : uint32 (codes .FailedPrecondition )}) // should return with code=FailedPrecondition
213
- require . Error ( s . T (), err )
213
+ s . Require (). Error ( err )
214
214
s .mock .Equal (s .T (), []* mockReport {{
215
215
CallMeta : CallMeta {Typ : Unary , Service : testpb .TestServiceFullName , Method : "PingError" },
216
216
postCalls : []error {status .Error (codes .FailedPrecondition , "Userspace error" )},
@@ -221,7 +221,7 @@ func (s *ClientInterceptorTestSuite) TestUnaryReporting() {
221
221
222
222
func (s * ClientInterceptorTestSuite ) TestStartedListReporting () {
223
223
_ , err := s .testClient .PingList (s .ctx , & testpb.PingListRequest {})
224
- require . NoError ( s . T (), err )
224
+ s . Require (). NoError ( err )
225
225
226
226
// Even without reading, we should get initial mockReport.
227
227
s .mock .Equal (s .T (), []* mockReport {{
@@ -230,7 +230,7 @@ func (s *ClientInterceptorTestSuite) TestStartedListReporting() {
230
230
}})
231
231
232
232
_ , err = s .testClient .PingList (s .ctx , & testpb.PingListRequest {ErrorCodeReturned : uint32 (codes .FailedPrecondition )})
233
- require . NoError ( s . T (), err , "PingList must not fail immediately" )
233
+ s . Require (). NoError ( err , "PingList must not fail immediately" )
234
234
235
235
// Even without reading, we should get initial mockReport.
236
236
s .mock .Equal (s .T (), []* mockReport {{
@@ -244,7 +244,7 @@ func (s *ClientInterceptorTestSuite) TestStartedListReporting() {
244
244
245
245
func (s * ClientInterceptorTestSuite ) TestListReporting () {
246
246
ss , err := s .testClient .PingList (s .ctx , & testpb.PingListRequest {})
247
- require . NoError ( s . T (), err )
247
+ s . Require (). NoError ( err )
248
248
249
249
// Do a read, just for kicks.
250
250
count := 0
@@ -253,10 +253,10 @@ func (s *ClientInterceptorTestSuite) TestListReporting() {
253
253
if errors .Is (err , io .EOF ) {
254
254
break
255
255
}
256
- require . NoError ( s . T (), err , "reading pingList shouldn't fail" )
256
+ s . Require (). NoError ( err , "reading pingList shouldn't fail" )
257
257
count ++
258
258
}
259
- require . EqualValues ( s . T (), testpb .ListResponseCount , count , "Number of received msg on the wire must match" )
259
+ s . Require (). Equal ( testpb .ListResponseCount , count , "Number of received msg on the wire must match" )
260
260
261
261
s .mock .Equal (s .T (), []* mockReport {{
262
262
CallMeta : CallMeta {Typ : ServerStream , Service : testpb .TestServiceFullName , Method : "PingList" },
@@ -267,19 +267,19 @@ func (s *ClientInterceptorTestSuite) TestListReporting() {
267
267
s .mock .reports = s .mock .reports [:0 ] // Reset.
268
268
269
269
ss , err = s .testClient .PingList (s .ctx , & testpb.PingListRequest {ErrorCodeReturned : uint32 (codes .FailedPrecondition )})
270
- require . NoError ( s . T (), err , "PingList must not fail immediately" )
270
+ s . Require (). NoError ( err , "PingList must not fail immediately" )
271
271
272
272
// Do a read, just to propagate errors.
273
273
_ , err = ss .Recv ()
274
- require . Error ( s . T (), err )
274
+ s . Require (). Error ( err )
275
275
st , _ := status .FromError (err )
276
- require . Equal ( s . T (), codes .FailedPrecondition , st .Code (), "Recv must return FailedPrecondition, otherwise the test is wrong" )
276
+ s . Require (). Equal ( codes .FailedPrecondition , st .Code (), "Recv must return FailedPrecondition, otherwise the test is wrong" )
277
277
278
278
// Next same.
279
279
_ , err = ss .Recv ()
280
- require . Error ( s . T (), err )
280
+ s . Require (). Error ( err )
281
281
st , _ = status .FromError (err )
282
- require . Equal ( s . T (), codes .FailedPrecondition , st .Code (), "Recv must return FailedPrecondition, otherwise the test is wrong" )
282
+ s . Require (). Equal ( codes .FailedPrecondition , st .Code (), "Recv must return FailedPrecondition, otherwise the test is wrong" )
283
283
284
284
s .mock .Equal (s .T (), []* mockReport {{
285
285
CallMeta : CallMeta {Typ : ServerStream , Service : testpb .TestServiceFullName , Method : "PingList" },
@@ -291,7 +291,7 @@ func (s *ClientInterceptorTestSuite) TestListReporting() {
291
291
292
292
func (s * ClientInterceptorTestSuite ) TestBiStreamingReporting () {
293
293
ss , err := s .testClient .PingStream (s .ctx )
294
- require . NoError ( s . T (), err )
294
+ s . Require (). NoError ( err )
295
295
296
296
wg := sync.WaitGroup {}
297
297
defer func () {
@@ -316,13 +316,13 @@ func (s *ClientInterceptorTestSuite) TestBiStreamingReporting() {
316
316
}
317
317
}()
318
318
for i := 0 ; i < 100 ; i ++ {
319
- require . NoError ( s . T (), ss .Send (& testpb.PingStreamRequest {}), "sending shouldn't fail" )
319
+ s . Require (). NoError ( ss .Send (& testpb.PingStreamRequest {}), "sending shouldn't fail" )
320
320
}
321
321
322
- require . NoError ( s . T (), ss .CloseSend ())
322
+ s . Require (). NoError ( ss .CloseSend ())
323
323
wg .Wait ()
324
324
325
- require . EqualValues ( s . T (), 100 , count , "Number of received msg on the wire must match" )
325
+ s . Require (). Equal ( 100 , count , "Number of received msg on the wire must match" )
326
326
s .mock .Equal (s .T (), []* mockReport {{
327
327
CallMeta : CallMeta {Typ : BidiStream , Service : testpb .TestServiceFullName , Method : "PingStream" },
328
328
postCalls : []error {nil },
@@ -333,18 +333,18 @@ func (s *ClientInterceptorTestSuite) TestBiStreamingReporting() {
333
333
334
334
func (s * ClientInterceptorTestSuite ) TestClientStream () {
335
335
ss , err := s .testClient .PingClientStream (s .ctx )
336
- require . NoError ( s . T (), err )
336
+ s . Require (). NoError ( err )
337
337
338
338
defer func () {
339
339
_ , _ = ss .CloseAndRecv ()
340
340
}()
341
341
342
342
for i := 0 ; i < 100 ; i ++ {
343
- require . NoError ( s . T (), ss .Send (& testpb.PingClientStreamRequest {}), "sending shouldn't fail" )
343
+ s . Require (). NoError ( ss .Send (& testpb.PingClientStreamRequest {}), "sending shouldn't fail" )
344
344
}
345
345
346
346
_ , err = ss .CloseAndRecv ()
347
- require . NoError ( s . T (), err )
347
+ s . Require (). NoError ( err )
348
348
349
349
s .mock .Equal (s .T (), []* mockReport {{
350
350
CallMeta : CallMeta {Typ : ClientStream , Service : testpb .TestServiceFullName , Method : "PingClientStream" },
0 commit comments