Skip to content

Commit

Permalink
chore: fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Feb 7, 2023
1 parent 3df8e09 commit 3186d16
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/migration/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"path/filepath"
"testing"
"time"

"github.com/filecoin-project/venus/fixtures/networks"
"github.com/filecoin-project/venus/pkg/config"
Expand All @@ -30,9 +31,8 @@ func TestMigration(t *testing.T) {
for nt, paramsCfg := range cfgs {
cfg := config.NewDefaultConfig()
cfg.NetworkParams.NetworkType = nt
repoPath := t.TempDir()
assert.Nil(t, os.RemoveAll(repoPath))
t.Log(repoPath)
repoPath := filepath.Join(os.TempDir(), fmt.Sprintf("TestMigration%d", time.Now().UnixNano()))

assert.Nil(t, repo.InitFSRepo(repoPath, 0, cfg))

assert.Nil(t, TryToMigrate(repoPath))
Expand All @@ -41,6 +41,7 @@ func TestMigration(t *testing.T) {
newCfg := fsRepo.Config()
assert.Equal(t, paramsCfg.NetworkType, newCfg.NetworkParams.NetworkType)
assert.EqualValuesf(t, config.NewDefaultConfig().NetworkParams.ForkUpgradeParam, newCfg.NetworkParams.ForkUpgradeParam, fmt.Sprintf("current network type %d", paramsCfg.NetworkType))
assert.NoError(t, fsRepo.Close())

cfgTmp, err := config.ReadFile(filepath.Join(repoPath, "config.json"))
assert.NoError(t, err)
Expand Down

0 comments on commit 3186d16

Please sign in to comment.