From 80c481fc0df4582495ce6453d1bab8c2c176ed10 Mon Sep 17 00:00:00 2001 From: Vlad Veselov Date: Tue, 20 Aug 2024 18:57:07 +0300 Subject: [PATCH] fix(config): change back to os.Exit(0) in order to repair unit test ``` 20s Run make unit-cover Running unit coverage tests. /home/runner/work/go/bin/go-acc $(go list -deps github.com/stroomnetwork/btcwallet/... | grep 'github.com/stroomnetwork/btcwallet') ? github.com/stroomnetwork/btcwallet/cfgutil [no test files] ok github.com/stroomnetwork/btcwallet/internal/zero 0.002s coverage: [1](https://github.com/stroomnetwork/btcwallet/actions/runs/10472707429/job/29002809093#step:7:1)00.0 ? github.com/stroomnetwork/btcwallet/netparams [no test files] ok github.com/stroomnetwork/btcwallet/snacl 0.200s coverage: 80.0 ok github.com/stroomnetwork/btcwallet/waddrmgr 0.365s coverage: 65.1 --- FAIL: TestPrunedBlockDispatcherMultipleQueryPeers (5.00s) pruned_block_dispatcher_test.go:635: expected nil err to signal completion pruned_block_dispatcher_test.go:186: did not consume all queriedPeer signals FAIL coverage: 19.7 FAIL github.com/stroomnetwork/btcwallet/chain 19.025s FAIL exit status 1make: *** [Makefile:96: unit-cover] Error 1 Error: Process completed with exit code 2. ``` Looks like failure happened due to a poorly written test: ``` // If we should expect a nil error to be sent by the internal // workManager to signal completion of the request, wait for it now. if expectCompletionSignal { select { case err := <-errChan: require.NoError(h.t, err) case <-time.After(5 * time.Second): h.t.Fatal("expected nil err to signal completion") } } ``` --- run/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run/config.go b/run/config.go index cc2bfc9df8..37225bbbef 100644 --- a/run/config.go +++ b/run/config.go @@ -518,7 +518,7 @@ func loadConfig(cfg *Config) error { } // Created successfully, so exit now with success. - return nil + os.Exit(0) } else if !dbFileExists && !cfg.NoInitialLoad { keystorePath := filepath.Join(netDir, keystore.Filename) keystoreExists, err := cfgutil.FileExists(keystorePath)