@@ -213,10 +213,21 @@ var (
213
213
}
214
214
215
215
endpoints = []struct {
216
- name string
217
- macaroonFn macaroonFn
218
- requestFn requestFn
219
- successPattern string
216
+ name string
217
+ macaroonFn macaroonFn
218
+ requestFn requestFn
219
+ successPattern string
220
+
221
+ // disabledPattern represents a substring that is expected to be
222
+ // part of the error returned when a gRPC request is made to the
223
+ // disabled endpoint.
224
+ // TODO: once we have a subsystem manager, we can unify the
225
+ // returned for disabled endpoints for both subsystems and
226
+ // subservers by not registering the subsystem URIs to the
227
+ // permsMgr if it has been disabled. This field will then be
228
+ // unnecessary and can be removed.
229
+ disabledPattern string
230
+
220
231
allowedThroughLNC bool
221
232
grpcWebURI string
222
233
restWebURI string
@@ -269,6 +280,7 @@ var (
269
280
macaroonFn : faradayMacaroonFn ,
270
281
requestFn : faradayRequestFn ,
271
282
successPattern : "\" reports\" :[]" ,
283
+ disabledPattern : "unknown request" ,
272
284
allowedThroughLNC : true ,
273
285
grpcWebURI : "/frdrpc.FaradayServer/RevenueReport" ,
274
286
restWebURI : "/v1/faraday/revenue" ,
@@ -278,6 +290,7 @@ var (
278
290
macaroonFn : loopMacaroonFn ,
279
291
requestFn : loopRequestFn ,
280
292
successPattern : "\" swaps\" :[]" ,
293
+ disabledPattern : "unknown request" ,
281
294
allowedThroughLNC : true ,
282
295
grpcWebURI : "/looprpc.SwapClient/ListSwaps" ,
283
296
restWebURI : "/v1/loop/swaps" ,
@@ -287,6 +300,7 @@ var (
287
300
macaroonFn : poolMacaroonFn ,
288
301
requestFn : poolRequestFn ,
289
302
successPattern : "\" accounts_active\" :0" ,
303
+ disabledPattern : "unknown request" ,
290
304
allowedThroughLNC : true ,
291
305
grpcWebURI : "/poolrpc.Trader/GetInfo" ,
292
306
restWebURI : "/v1/pool/info" ,
@@ -296,6 +310,7 @@ var (
296
310
macaroonFn : tapMacaroonFn ,
297
311
requestFn : tapRequestFn ,
298
312
successPattern : "\" assets\" :[]" ,
313
+ disabledPattern : "unknown request" ,
299
314
allowedThroughLNC : true ,
300
315
grpcWebURI : "/taprpc.TaprootAssets/ListAssets" ,
301
316
restWebURI : "/v1/taproot-assets/assets" ,
@@ -305,6 +320,7 @@ var (
305
320
macaroonFn : emptyMacaroonFn ,
306
321
requestFn : tapUniverseRequestFn ,
307
322
successPattern : "\" num_assets\" :" ,
323
+ disabledPattern : "unknown request" ,
308
324
allowedThroughLNC : true ,
309
325
grpcWebURI : "/universerpc.Universe/Info" ,
310
326
restWebURI : "/v1/taproot-assets/universe/info" ,
@@ -326,9 +342,11 @@ var (
326
342
macaroonFn : litMacaroonFn ,
327
343
requestFn : litAccountRequestFn ,
328
344
successPattern : "\" accounts\" :[" ,
345
+ disabledPattern : "accounts has been disabled" ,
329
346
allowedThroughLNC : false ,
330
347
grpcWebURI : "/litrpc.Accounts/ListAccounts" ,
331
348
restWebURI : "/v1/accounts" ,
349
+ canDisable : true ,
332
350
}, {
333
351
name : "litrpc-autopilot" ,
334
352
macaroonFn : litMacaroonFn ,
@@ -384,6 +402,7 @@ func testDisablingSubServers(ctx context.Context, net *NetworkHarness,
384
402
WithLitArg ("loop-mode" , "disable" ),
385
403
WithLitArg ("pool-mode" , "disable" ),
386
404
WithLitArg ("faraday-mode" , "disable" ),
405
+ WithLitArg ("accounts.disable" , "" ),
387
406
},
388
407
)
389
408
require .NoError (t , err )
@@ -494,7 +513,7 @@ func integratedTestSuite(ctx context.Context, net *NetworkHarness, t *testing.T,
494
513
endpoint .requestFn ,
495
514
endpoint .successPattern ,
496
515
endpointDisabled ,
497
- "unknown request" ,
516
+ endpoint . disabledPattern ,
498
517
)
499
518
})
500
519
}
@@ -532,7 +551,7 @@ func integratedTestSuite(ctx context.Context, net *NetworkHarness, t *testing.T,
532
551
shouldFailWithoutMacaroon ,
533
552
endpoint .successPattern ,
534
553
endpointDisabled ,
535
- "unknown request" ,
554
+ endpoint . disabledPattern ,
536
555
)
537
556
})
538
557
}
@@ -557,7 +576,8 @@ func integratedTestSuite(ctx context.Context, net *NetworkHarness, t *testing.T,
557
576
ttt , cfg .LitAddr (), cfg .UIPassword ,
558
577
endpoint .grpcWebURI ,
559
578
withoutUIPassword , endpointDisabled ,
560
- "unknown request" , endpoint .noAuth ,
579
+ endpoint .disabledPattern ,
580
+ endpoint .noAuth ,
561
581
)
562
582
})
563
583
}
@@ -596,7 +616,7 @@ func integratedTestSuite(ctx context.Context, net *NetworkHarness, t *testing.T,
596
616
endpoint .requestFn ,
597
617
endpoint .successPattern ,
598
618
endpointDisabled ,
599
- "unknown request" ,
619
+ endpoint . disabledPattern ,
600
620
)
601
621
})
602
622
}
@@ -649,7 +669,9 @@ func integratedTestSuite(ctx context.Context, net *NetworkHarness, t *testing.T,
649
669
endpoint .successPattern ,
650
670
endpoint .allowedThroughLNC ,
651
671
"unknown service" ,
652
- endpointDisabled , endpoint .noAuth ,
672
+ endpointDisabled ,
673
+ endpoint .disabledPattern ,
674
+ endpoint .noAuth ,
653
675
)
654
676
})
655
677
}
@@ -658,6 +680,12 @@ func integratedTestSuite(ctx context.Context, net *NetworkHarness, t *testing.T,
658
680
t .Run ("gRPC super macaroon account system test" , func (tt * testing.T ) {
659
681
cfg := net .Alice .Cfg
660
682
683
+ // If the accounts service is disabled, we skip this test as it
684
+ // will fail due to the accounts service being disabled.
685
+ if subServersDisabled {
686
+ return
687
+ }
688
+
661
689
superMacFile , err := bakeSuperMacaroon (cfg , false )
662
690
require .NoError (tt , err )
663
691
@@ -722,6 +750,7 @@ func integratedTestSuite(ctx context.Context, net *NetworkHarness, t *testing.T,
722
750
endpoint .successPattern ,
723
751
allowed , expectedErr ,
724
752
endpointDisabled ,
753
+ endpoint .disabledPattern ,
725
754
endpoint .noAuth ,
726
755
)
727
756
})
@@ -1169,7 +1198,8 @@ func runRESTAuthTest(t *testing.T, hostPort, uiPassword, macaroonPath, restURI,
1169
1198
// through Lightning Node Connect.
1170
1199
func runLNCAuthTest (t * testing.T , rawLNCConn grpc.ClientConnInterface ,
1171
1200
makeRequest requestFn , successContent string , callAllowed bool ,
1172
- expectErrContains string , disabled , noMac bool ) {
1201
+ expectErrContains string , disabled bool , disabledPattern string ,
1202
+ noMac bool ) {
1173
1203
1174
1204
ctxt , cancel := context .WithTimeout (
1175
1205
context .Background (), defaultTimeout ,
@@ -1186,7 +1216,7 @@ func runLNCAuthTest(t *testing.T, rawLNCConn grpc.ClientConnInterface,
1186
1216
// The call should be allowed, so we expect no error unless this is
1187
1217
// for a disabled sub-server.
1188
1218
case disabled :
1189
- require .ErrorContains (t , err , "unknown request" )
1219
+ require .ErrorContains (t , err , disabledPattern )
1190
1220
return
1191
1221
1192
1222
case noMac :
0 commit comments