@@ -16,8 +16,8 @@ import (
1616 "google.golang.org/grpc/metadata"
1717 "google.golang.org/protobuf/types/known/emptypb"
1818
19- "github.com/smartcontractkit/chainlink-common/pkg/nodeauth/jwt/mocks"
2019 "github.com/smartcontractkit/chainlink-common/pkg/logger"
20+ "github.com/smartcontractkit/chainlink-common/pkg/nodeauth/jwt/mocks"
2121 pb "github.com/smartcontractkit/chainlink-protos/billing/go"
2222)
2323
@@ -30,7 +30,6 @@ func (d MockRequest) String() string {
3030 return d .Field
3131}
3232
33-
3433// ---------- Test Server Implementation ----------
3534
3635// testWorkflowServer implements pb.WorkflowServiceServer for testing.
@@ -101,11 +100,10 @@ func TestIntegration_GRPCWithCerts(t *testing.T) {
101100 mockJWT .EXPECT ().CreateJWTForRequest (& pb.GetRateCardRequest {WorkflowOwner : "test-account" , WorkflowRegistryAddress : "0x.." , ChainSelector : 1 }).Return ("test.jwt.token" , nil ).Once ()
102101
103102 lggr := logger .Test (t )
104- wc , err := NewWorkflowClient (addr ,
103+ wc , err := NewWorkflowClient (lggr , addr ,
105104 WithWorkflowTransportCredentials (clientCreds ), // Provided but may be overridden by TLS cert.
106105 WithWorkflowTLSCert (string (certBytes )),
107106 WithJWTGenerator (mockJWT ),
108- WithWorkflowLogger (lggr ),
109107 WithServerName ("localhost" ),
110108 )
111109 require .NoError (t , err )
@@ -153,9 +151,8 @@ func TestIntegration_GRPC_Insecure(t *testing.T) {
153151 addr := lis .Addr ().String ()
154152 lggr := logger .Test (t )
155153
156- wc , err := NewWorkflowClient (addr ,
154+ wc , err := NewWorkflowClient (lggr , addr ,
157155 WithWorkflowTransportCredentials (insecure .NewCredentials ()),
158- WithWorkflowLogger (lggr ),
159156 WithServerName ("localhost" ),
160157 )
161158
@@ -170,9 +167,8 @@ func TestIntegration_GRPC_Insecure(t *testing.T) {
170167// Test that NewWorkflowClient fails when given an invalid address.
171168func TestNewWorkflowClient_InvalidAddress (t * testing.T ) {
172169 lggr := logger .Test (t )
173- wc , err := NewWorkflowClient ("invalid-address" ,
170+ wc , err := NewWorkflowClient (lggr , "invalid-address" ,
174171 WithWorkflowTransportCredentials (insecure .NewCredentials ()),
175- WithWorkflowLogger (lggr ),
176172 WithServerName ("localhost" ),
177173 )
178174
@@ -196,9 +192,8 @@ func TestWorkflowClient_CloseTwice(t *testing.T) {
196192
197193 addr := lis .Addr ().String ()
198194 lggr := logger .Test (t )
199- wc , err := NewWorkflowClient (addr ,
195+ wc , err := NewWorkflowClient (lggr , addr ,
200196 WithWorkflowTransportCredentials (insecure .NewCredentials ()),
201- WithWorkflowLogger (lggr ),
202197 WithServerName ("localhost" ),
203198 )
204199 require .NoError (t , err )
@@ -215,9 +210,8 @@ func TestWorkflowClient_CloseTwice(t *testing.T) {
215210func TestWorkflowClient_DialUnreachable (t * testing.T ) {
216211 lggr := logger .Test (t )
217212 unreachableAddr := "192.0.2.1:12345" // Reserved for documentation.
218- wc , err := NewWorkflowClient (unreachableAddr ,
213+ wc , err := NewWorkflowClient (lggr , unreachableAddr ,
219214 WithWorkflowTransportCredentials (insecure .NewCredentials ()),
220- WithWorkflowLogger (lggr ),
221215 WithServerName ("localhost" ),
222216 )
223217
@@ -240,7 +234,7 @@ func TestWorkflowClient_AddJWTAuthToContext(t *testing.T) {
240234 mockJWT .EXPECT ().CreateJWTForRequest (req ).Return (expectedToken , nil ).Once ()
241235
242236 wc := & workflowClient {
243- logger : logger .Test (t ),
237+ logger : logger .Test (t ),
244238 jwtGenerator : mockJWT ,
245239 }
246240
@@ -263,7 +257,7 @@ func TestWorkflowClient_NoSigningKey(t *testing.T) {
263257 ctx := context .Background ()
264258 req := MockRequest {Field : "test" }
265259 wc := & workflowClient {
266- logger : logger .Test (t ),
260+ logger : logger .Test (t ),
267261 jwtGenerator : nil ,
268262 }
269263 newCtx , err := wc .addJWTAuth (ctx , req )
@@ -281,7 +275,7 @@ func TestWorkflowClient_VerifySignature_Invalid(t *testing.T) {
281275 mockJWT .EXPECT ().CreateJWTForRequest (req ).Return ("" , fmt .Errorf ("mock JWT creation error" )).Once ()
282276
283277 wc := & workflowClient {
284- logger : logger .Test (t ),
278+ logger : logger .Test (t ),
285279 jwtGenerator : mockJWT ,
286280 }
287281
@@ -300,7 +294,7 @@ func TestWorkflowClient_RepeatedSign(t *testing.T) {
300294 mockJWT .EXPECT ().CreateJWTForRequest (req ).Return (expectedToken , nil ).Times (2 )
301295
302296 wc := & workflowClient {
303- logger : logger .Test (t ),
297+ logger : logger .Test (t ),
304298 jwtGenerator : mockJWT ,
305299 }
306300
@@ -319,4 +313,4 @@ func TestWorkflowClient_RepeatedSign(t *testing.T) {
319313 require .True (t , ok )
320314
321315 assert .Equal (t , md1 ["authorization" ], md2 ["authorization" ], "Expected same authorization header for same request" )
322- }
316+ }
0 commit comments