Skip to content

Commit

Permalink
fix server tests
Browse files Browse the repository at this point in the history
  • Loading branch information
millken committed Apr 14, 2023
1 parent 68d964a commit e050ec6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/itx/heartbeat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ func TestNewHeartbeatHandler(t *testing.T) {
triePath, err := testutil.PathOfTempFile("trie.db")
require.NoError(err)
testutil.CleanupPath(triePath)
sgdPath, err := testutil.PathOfTempFile("sgd.db")
require.NoError(err)
defer func() {
testutil.CleanupPath(dbPath)
testutil.CleanupPath(triePath)
testutil.CleanupPath(sgdPath)
}()
cfg := config.Default
cfg.API.GRPCPort = testutil.RandomPort()
Expand All @@ -37,6 +40,7 @@ func TestNewHeartbeatHandler(t *testing.T) {
cfg.Chain.ChainDBPath = dbPath
cfg.Chain.TrieDBPath = triePath
cfg.Chain.TrieDBPatchFile = ""
cfg.Chain.SGDIndexDBPath = sgdPath
s, err := NewServer(cfg)
cfg.Consensus.Scheme = config.RollDPoSScheme
cfg.Genesis.EnableGravityChainVoting = true
Expand Down
4 changes: 4 additions & 0 deletions server/itx/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,19 @@ func newConfig(t *testing.T) (config.Config, func()) {
require.NoError(err)
triePath, err := testutil.PathOfTempFile("trie.db")
require.NoError(err)
sgdIndexPath, err := testutil.PathOfTempFile("sgd.db")
require.NoError(err)
cfg := config.Default
cfg.API.GRPCPort = testutil.RandomPort()
cfg.API.HTTPPort = testutil.RandomPort()
cfg.API.WebSocketPort = testutil.RandomPort()
cfg.Chain.ChainDBPath = dbPath
cfg.Chain.TrieDBPath = triePath
cfg.Chain.TrieDBPatchFile = ""
cfg.Chain.SGDIndexDBPath = sgdIndexPath
return cfg, func() {
testutil.CleanupPath(dbPath)
testutil.CleanupPath(triePath)
testutil.CleanupPath(sgdIndexPath)
}
}

0 comments on commit e050ec6

Please sign in to comment.