cleanup tests on finish
This commit is contained in:
@@ -101,8 +101,7 @@ func CreateTestStorageNode(ctx context.Context, t *testing.T, waddr address.Addr
|
||||
var minerapi api.StorageMiner
|
||||
|
||||
mineBlock := make(chan miner2.MineReq)
|
||||
// TODO: use stop
|
||||
_, err = node.New(ctx,
|
||||
stop, err := node.New(ctx,
|
||||
node.StorageMiner(&minerapi),
|
||||
node.Online(),
|
||||
node.Repo(r),
|
||||
@@ -118,6 +117,7 @@ func CreateTestStorageNode(ctx context.Context, t *testing.T, waddr address.Addr
|
||||
if err != nil {
|
||||
t.Fatalf("failed to construct node: %v", err)
|
||||
}
|
||||
t.Cleanup(func() { _ = stop(context.Background()) })
|
||||
|
||||
/*// Bootstrap with full node
|
||||
remoteAddrs, err := tnd.NetAddrsListen(ctx)
|
||||
@@ -138,7 +138,9 @@ func CreateTestStorageNode(ctx context.Context, t *testing.T, waddr address.Addr
|
||||
}
|
||||
|
||||
func Builder(t *testing.T, nFull int, storage []test.StorageMiner, opts ...node.Option) ([]test.TestNode, []test.TestStorageNode) {
|
||||
ctx := context.Background()
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
t.Cleanup(cancel)
|
||||
|
||||
mn := mocknet.New(ctx)
|
||||
|
||||
fulls := make([]test.TestNode, nFull)
|
||||
@@ -214,9 +216,7 @@ func Builder(t *testing.T, nFull int, storage []test.StorageMiner, opts ...node.
|
||||
genesis = node.Override(new(modules.Genesis), modules.LoadGenesis(genbuf.Bytes()))
|
||||
}
|
||||
|
||||
var err error
|
||||
// TODO: Don't ignore stop
|
||||
_, err = node.New(ctx,
|
||||
stop, err := node.New(ctx,
|
||||
node.FullAPI(&fulls[i].FullNode),
|
||||
node.Online(),
|
||||
node.Repo(repo.NewMemory(nil)),
|
||||
@@ -229,7 +229,7 @@ func Builder(t *testing.T, nFull int, storage []test.StorageMiner, opts ...node.
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
t.Cleanup(func() { _ = stop(context.Background()) })
|
||||
}
|
||||
|
||||
for i, def := range storage {
|
||||
@@ -364,7 +364,7 @@ func MockSbBuilder(t *testing.T, nFull int, storage []test.StorageMiner, options
|
||||
|
||||
var err error
|
||||
// TODO: Don't ignore stop
|
||||
_, err = node.New(ctx,
|
||||
stop, err := node.New(ctx,
|
||||
node.FullAPI(&fulls[i].FullNode),
|
||||
node.Online(),
|
||||
node.Repo(repo.NewMemory(nil)),
|
||||
@@ -379,6 +379,7 @@ func MockSbBuilder(t *testing.T, nFull int, storage []test.StorageMiner, options
|
||||
if err != nil {
|
||||
t.Fatalf("%+v", err)
|
||||
}
|
||||
t.Cleanup(func() { _ = stop(context.Background()) })
|
||||
}
|
||||
|
||||
for i, def := range storage {
|
||||
|
||||
Reference in New Issue
Block a user