Skip to content

Commit

Permalink
fix(config): change back to os.Exit(0) in order to repair unit test
Browse files Browse the repository at this point in the history
```
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")
		}
	}
```
  • Loading branch information
orlangur committed Aug 21, 2024
1 parent 5e3470d commit 80c481f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion run/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 80c481f

Please sign in to comment.