@@ -18,8 +18,8 @@ import (
18
18
"google.golang.org/grpc/credentials/insecure"
19
19
"google.golang.org/grpc/metadata"
20
20
21
- pb "github.com/smartcontractkit/chainlink-protos/billing/go"
22
21
"github.com/smartcontractkit/chainlink-common/pkg/logger"
22
+ pb "github.com/smartcontractkit/chainlink-protos/billing/go"
23
23
)
24
24
25
25
// ---------- Test Server Implementation ----------
@@ -162,15 +162,20 @@ func TestIntegration_GRPC_Insecure(t *testing.T) {
162
162
defer grpcServer .Stop ()
163
163
164
164
addr := lis .Addr ().String ()
165
-
166
165
lggr := logger .Test (t )
166
+
167
167
wc , err := NewWorkflowClient (addr ,
168
168
WithWorkflowTransportCredentials (insecure .NewCredentials ()),
169
169
WithWorkflowLogger (lggr ),
170
170
WithServerName ("localhost" ),
171
171
)
172
+
173
+ assert .NoError (t , err )
174
+ assert .NotNil (t , wc )
175
+
176
+ _ , err = wc .ConsumeCredits (t .Context (), nil )
177
+
172
178
require .Error (t , err )
173
- assert .Nil (t , wc )
174
179
}
175
180
176
181
// Test that CanonicalStringFromRequest returns the correct string.
@@ -275,11 +280,17 @@ func TestWorkflowClient_CustomAuthHeader(t *testing.T) {
275
280
// Test that NewWorkflowClient fails when given an invalid address.
276
281
func TestNewWorkflowClient_InvalidAddress (t * testing.T ) {
277
282
lggr := logger .Test (t )
278
- _ , err := NewWorkflowClient ("invalid-address" ,
283
+ wc , err := NewWorkflowClient ("invalid-address" ,
279
284
WithWorkflowTransportCredentials (insecure .NewCredentials ()),
280
285
WithWorkflowLogger (lggr ),
281
286
WithServerName ("localhost" ),
282
287
)
288
+
289
+ require .NotNil (t , wc )
290
+ require .NoError (t , err )
291
+
292
+ _ , err = wc .ConsumeCredits (t .Context (), nil )
293
+
283
294
require .Error (t , err , "Expected error when dialing an invalid address" )
284
295
}
285
296
@@ -337,10 +348,16 @@ func TestWorkflowClient_RepeatedSign(t *testing.T) {
337
348
func TestWorkflowClient_DialUnreachable (t * testing.T ) {
338
349
lggr := logger .Test (t )
339
350
unreachableAddr := "192.0.2.1:12345" // Reserved for documentation.
340
- _ , err := NewWorkflowClient (unreachableAddr ,
351
+ wc , err := NewWorkflowClient (unreachableAddr ,
341
352
WithWorkflowTransportCredentials (insecure .NewCredentials ()),
342
353
WithWorkflowLogger (lggr ),
343
354
WithServerName ("localhost" ),
344
355
)
356
+
357
+ require .NotNil (t , wc )
358
+ require .NoError (t , err )
359
+
360
+ _ , err = wc .ConsumeCredits (t .Context (), nil )
361
+
345
362
require .Error (t , err , "Expected dialing an unreachable address to fail" )
346
363
}
0 commit comments