From 088e2114c220a5db8db2b225ef2aee50c87cea90 Mon Sep 17 00:00:00 2001 From: Ori Newman Date: Wed, 31 Mar 2021 13:44:42 +0300 Subject: [PATCH] Disconnect from RPC client after finishing the simple sync test (#1641) --- stability-tests/simple-sync/main.go | 2 ++ stability-tests/simple-sync/mineloop.go | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/stability-tests/simple-sync/main.go b/stability-tests/simple-sync/main.go index 20d730395..aedcec8ef 100644 --- a/stability-tests/simple-sync/main.go +++ b/stability-tests/simple-sync/main.go @@ -49,6 +49,7 @@ func realMain() error { if err != nil { return errors.Wrap(err, "error connecting to RPC server") } + defer syncerRPCClient.Disconnect() syncedRPCClient, err := rpc.ConnectToRPC(&rpc.Config{ RPCServer: syncedRPCAddress, @@ -56,6 +57,7 @@ func realMain() error { if err != nil { return errors.Wrap(err, "error connecting to RPC server") } + defer syncedRPCClient.Disconnect() err = syncedRPCClient.RegisterForBlockAddedNotifications() if err != nil { diff --git a/stability-tests/simple-sync/mineloop.go b/stability-tests/simple-sync/mineloop.go index 7ddf70b74..0047979d3 100644 --- a/stability-tests/simple-sync/mineloop.go +++ b/stability-tests/simple-sync/mineloop.go @@ -56,10 +56,16 @@ func mineLoop(syncerRPCClient, syncedRPCClient *rpc.Client) error { return errors.Errorf("syncer node has tips %s but synced node has tips %s", syncerResult.TipHashes, syncedResult.TipHashes) } } + + log.Infof("Finished to mine") + + log.Infof("Getting syncer block count") syncerBlockCountAfter, err := syncerRPCClient.GetBlockCount() if err != nil { return err } + + log.Infof("Getting syncee block count") syncedBlockCountAfter, err := syncedRPCClient.GetBlockCount() if err != nil { return err @@ -70,6 +76,8 @@ func mineLoop(syncerRPCClient, syncedRPCClient *rpc.Client) error { if syncedBlockCountAfter.BlockCount-syncedBlockCountBefore.BlockCount != activeConfig().NumberOfBlocks { return errors.Errorf("Expected syncer to have %d new blocks, instead have: %d", activeConfig().NumberOfBlocks, syncedBlockCountAfter.BlockCount-syncedBlockCountBefore.BlockCount) } + + log.Infof("Finished the mine loop successfully") return nil }