itest: fix crash in parallel macaroon tests

This commit is contained in:
Andras Banki-Horvath 2020-10-30 17:54:29 +01:00
parent 979c8497b2
commit 9eac0dd3c9
No known key found for this signature in database
GPG Key ID: 80E5375C094198D8

@ -22,7 +22,7 @@ import (
// enabled on the gRPC interface, no requests with missing or invalid // enabled on the gRPC interface, no requests with missing or invalid
// macaroons are allowed. Further, the specific access rights (read/write, // macaroons are allowed. Further, the specific access rights (read/write,
// entity based) and first-party caveats are tested as well. // entity based) and first-party caveats are tested as well.
func testMacaroonAuthentication(net *lntest.NetworkHarness, t *harnessTest) { func testMacaroonAuthentication(net *lntest.NetworkHarness, ht *harnessTest) {
var ( var (
infoReq = &lnrpc.GetInfoRequest{} infoReq = &lnrpc.GetInfoRequest{}
newAddrReq = &lnrpc.NewAddressRequest{ newAddrReq = &lnrpc.NewAddressRequest{
@ -200,15 +200,13 @@ func testMacaroonAuthentication(net *lntest.NetworkHarness, t *harnessTest) {
for _, tc := range testCases { for _, tc := range testCases {
tc := tc tc := tc
t.t.Run(tc.name, func(t *testing.T) { ht.t.Run(tc.name, func(tt *testing.T) {
t.Parallel()
ctxt, cancel := context.WithTimeout( ctxt, cancel := context.WithTimeout(
context.Background(), defaultTimeout, context.Background(), defaultTimeout,
) )
defer cancel() defer cancel()
tc.run(ctxt, t) tc.run(ctxt, tt)
}) })
} }
} }
@ -377,9 +375,7 @@ func testBakeMacaroon(net *lntest.NetworkHarness, t *harnessTest) {
for _, tc := range testCases { for _, tc := range testCases {
tc := tc tc := tc
t.t.Run(tc.name, func(t *testing.T) { t.t.Run(tc.name, func(tt *testing.T) {
t.Parallel()
ctxt, cancel := context.WithTimeout( ctxt, cancel := context.WithTimeout(
context.Background(), defaultTimeout, context.Background(), defaultTimeout,
) )
@ -388,11 +384,11 @@ func testBakeMacaroon(net *lntest.NetworkHarness, t *harnessTest) {
adminMac, err := testNode.ReadMacaroon( adminMac, err := testNode.ReadMacaroon(
testNode.AdminMacPath(), defaultTimeout, testNode.AdminMacPath(), defaultTimeout,
) )
require.NoError(t, err) require.NoError(tt, err)
cleanup, client := macaroonClient(t, testNode, adminMac) cleanup, client := macaroonClient(tt, testNode, adminMac)
defer cleanup() defer cleanup()
tc.run(ctxt, t, client) tc.run(ctxt, tt, client)
}) })
} }
} }