@@ -34,6 +34,7 @@ import (
34
34
"google.golang.org/grpc/codes"
35
35
"google.golang.org/grpc/credentials"
36
36
"google.golang.org/grpc/grpclog"
37
+ "google.golang.org/grpc/status"
37
38
"google.golang.org/grpc/testdata"
38
39
)
39
40
@@ -117,7 +118,7 @@ func createConns(config *testpb.ClientConfig) ([]*grpc.ClientConn, func(), error
117
118
case testpb .ClientType_SYNC_CLIENT :
118
119
case testpb .ClientType_ASYNC_CLIENT :
119
120
default :
120
- return nil , nil , grpc .Errorf (codes .InvalidArgument , "unknow client type: %v" , config .ClientType )
121
+ return nil , nil , status .Errorf (codes .InvalidArgument , "unknow client type: %v" , config .ClientType )
121
122
}
122
123
123
124
// Check and set security options.
@@ -127,7 +128,7 @@ func createConns(config *testpb.ClientConfig) ([]*grpc.ClientConn, func(), error
127
128
}
128
129
creds , err := credentials .NewClientTLSFromFile (* caFile , config .SecurityParams .ServerHostOverride )
129
130
if err != nil {
130
- return nil , nil , grpc .Errorf (codes .InvalidArgument , "failed to create TLS credentials %v" , err )
131
+ return nil , nil , status .Errorf (codes .InvalidArgument , "failed to create TLS credentials %v" , err )
131
132
}
132
133
opts = append (opts , grpc .WithTransportCredentials (creds ))
133
134
} else {
@@ -141,7 +142,7 @@ func createConns(config *testpb.ClientConfig) ([]*grpc.ClientConn, func(), error
141
142
opts = append (opts , grpc .WithCodec (byteBufCodec {}))
142
143
case * testpb.PayloadConfig_SimpleParams :
143
144
default :
144
- return nil , nil , grpc .Errorf (codes .InvalidArgument , "unknow payload config: %v" , config .PayloadConfig )
145
+ return nil , nil , status .Errorf (codes .InvalidArgument , "unknow payload config: %v" , config .PayloadConfig )
145
146
}
146
147
}
147
148
@@ -176,17 +177,17 @@ func performRPCs(config *testpb.ClientConfig, conns []*grpc.ClientConn, bc *benc
176
177
payloadRespSize = int (c .SimpleParams .RespSize )
177
178
payloadType = "protobuf"
178
179
default :
179
- return grpc .Errorf (codes .InvalidArgument , "unknow payload config: %v" , config .PayloadConfig )
180
+ return status .Errorf (codes .InvalidArgument , "unknow payload config: %v" , config .PayloadConfig )
180
181
}
181
182
}
182
183
183
184
// TODO add open loop distribution.
184
185
switch config .LoadParams .Load .(type ) {
185
186
case * testpb.LoadParams_ClosedLoop :
186
187
case * testpb.LoadParams_Poisson :
187
- return grpc .Errorf (codes .Unimplemented , "unsupported load params: %v" , config .LoadParams )
188
+ return status .Errorf (codes .Unimplemented , "unsupported load params: %v" , config .LoadParams )
188
189
default :
189
- return grpc .Errorf (codes .InvalidArgument , "unknown load params: %v" , config .LoadParams )
190
+ return status .Errorf (codes .InvalidArgument , "unknown load params: %v" , config .LoadParams )
190
191
}
191
192
192
193
rpcCountPerConn := int (config .OutstandingRpcsPerChannel )
@@ -199,7 +200,7 @@ func performRPCs(config *testpb.ClientConfig, conns []*grpc.ClientConn, bc *benc
199
200
bc .doCloseLoopStreaming (conns , rpcCountPerConn , payloadReqSize , payloadRespSize , payloadType )
200
201
// TODO open loop.
201
202
default :
202
- return grpc .Errorf (codes .InvalidArgument , "unknown rpc type: %v" , config .RpcType )
203
+ return status .Errorf (codes .InvalidArgument , "unknown rpc type: %v" , config .RpcType )
203
204
}
204
205
205
206
return nil
0 commit comments