mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 23:02:27 +00:00
*: fix tests failing due to path.Join usage
Solution: Use `file/filepath` package to construct expected path. This package is OS-aware, see https://github.com/golang/go/issues/30616.
This commit is contained in:
parent
6cdb701a9d
commit
aefb6f9fee
21 changed files with 118 additions and 116 deletions
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
|
@ -14,8 +14,8 @@ import (
|
|||
func TestDBRestore(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
|
||||
chainPath := path.Join(tmpDir, "neogotestchain")
|
||||
cfg, err := config.LoadFile("../config/protocol.unit_testnet.yml")
|
||||
chainPath := filepath.Join(tmpDir, "neogotestchain")
|
||||
cfg, err := config.LoadFile(filepath.Join("..", "config", "protocol.unit_testnet.yml"))
|
||||
require.NoError(t, err, "could not load config")
|
||||
cfg.ApplicationConfiguration.DBConfiguration.Type = "leveldb"
|
||||
cfg.ApplicationConfiguration.DBConfiguration.LevelDBOptions.DataDirectoryPath = chainPath
|
||||
|
@ -23,13 +23,13 @@ func TestDBRestore(t *testing.T) {
|
|||
out, err := yaml.Marshal(cfg)
|
||||
require.NoError(t, err)
|
||||
|
||||
cfgPath := path.Join(tmpDir, "protocol.unit_testnet.yml")
|
||||
cfgPath := filepath.Join(tmpDir, "protocol.unit_testnet.yml")
|
||||
require.NoError(t, ioutil.WriteFile(cfgPath, out, os.ModePerm))
|
||||
|
||||
// generated via `go run ./scripts/gendump/main.go --out ./cli/testdata/chain50x2.acc --blocks 50 --txs 2`
|
||||
const inDump = "./testdata/chain50x2.acc"
|
||||
e := newExecutor(t, false)
|
||||
stateDump := path.Join(tmpDir, "neogo.teststate")
|
||||
stateDump := filepath.Join(tmpDir, "neogo.teststate")
|
||||
baseArgs := []string{"neo-go", "db", "restore", "--unittest",
|
||||
"--config-path", tmpDir, "--in", inDump, "--dump", stateDump}
|
||||
|
||||
|
@ -46,7 +46,7 @@ func TestDBRestore(t *testing.T) {
|
|||
e.Run(t, baseArgs...)
|
||||
|
||||
// Dump and compare.
|
||||
dumpPath := path.Join(tmpDir, "testdump.acc")
|
||||
dumpPath := filepath.Join(tmpDir, "testdump.acc")
|
||||
e.Run(t, "neo-go", "db", "dump", "--unittest",
|
||||
"--config-path", tmpDir, "--out", dumpPath)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue