@@ -20,6 +20,7 @@ import (
2020 "testing"
2121 "time"
2222
23+ "github.com/stretchr/testify/require"
2324 "go.uber.org/zap"
2425 "golang.org/x/time/rate"
2526
@@ -62,15 +63,11 @@ func SimulateTraffic(ctx context.Context, t *testing.T, lg *zap.Logger, clus *e2
6263 limiter := rate .NewLimiter (rate .Limit (profile .MaximalQPS ), 200 )
6364
6465 cc , err := client .NewRecordingClient (endpoints , ids , baseTime )
65- if err != nil {
66- t .Fatal (err )
67- }
66+ require .NoError (t , err )
6867 defer cc .Close ()
6968 // Ensure that first operation succeeds
7069 _ , err = cc .Put (ctx , "start" , "true" )
71- if err != nil {
72- t .Fatalf ("First operation failed, validation requires first operation to succeed, err: %s" , err )
73- }
70+ require .NoErrorf (t , err , "First operation failed, validation requires first operation to succeed" )
7471 wg := sync.WaitGroup {}
7572 nonUniqueWriteLimiter := NewConcurrencyLimiter (profile .MaxNonUniqueRequestConcurrency )
7673 finish := make (chan struct {})
@@ -79,9 +76,7 @@ func SimulateTraffic(ctx context.Context, t *testing.T, lg *zap.Logger, clus *e2
7976 for i := 0 ; i < profile .ClientCount ; i ++ {
8077 wg .Add (1 )
8178 c , nerr := client .NewRecordingClient ([]string {endpoints [i % len (endpoints )]}, ids , baseTime )
82- if nerr != nil {
83- t .Fatal (nerr )
84- }
79+ require .NoError (t , nerr )
8580 go func (c * client.RecordingClient ) {
8681 defer wg .Done ()
8782 defer c .Close ()
@@ -111,9 +106,7 @@ func SimulateTraffic(ctx context.Context, t *testing.T, lg *zap.Logger, clus *e2
111106 var fr * report.FailpointInjection
112107 select {
113108 case frp , ok := <- failpointInjected :
114- if ! ok {
115- t .Fatalf ("Failed to collect failpoint report" )
116- }
109+ require .Truef (t , ok , "Failed to collect failpoint report" )
117110 fr = & frp
118111 case <- ctx .Done ():
119112 t .Fatalf ("Traffic finished before failure was injected: %s" , ctx .Err ())
@@ -126,9 +119,7 @@ func SimulateTraffic(ctx context.Context, t *testing.T, lg *zap.Logger, clus *e2
126119 time .Sleep (time .Second )
127120 // Ensure that last operation succeeds
128121 _ , err = cc .Put (ctx , "tombstone" , "true" )
129- if err != nil {
130- t .Fatalf ("Last operation failed, validation requires last operation to succeed, err: %s" , err )
131- }
122+ require .NoErrorf (t , err , "Last operation failed, validation requires last operation to succeed" )
132123 reports = append (reports , cc .Report ())
133124
134125 totalStats := calculateStats (reports , startTime , endTime )
0 commit comments