*: create real temporary dirs and files in tests

Improve reliability.
This commit is contained in:
Roman Khimov 2021-07-20 12:32:02 +03:00
parent 3b19b34122
commit 0583f252ab
8 changed files with 77 additions and 59 deletions

View file

@ -2,6 +2,7 @@ package main
import (
"encoding/hex"
"io/ioutil"
"math/big"
"os"
"path"
@ -27,12 +28,12 @@ func TestSignMultisigTx(t *testing.T) {
multisigAddr := address.Uint160ToString(multisigHash)
// Create 2 wallets participating in multisig.
tmpDir := os.TempDir()
tmpDir, err := ioutil.TempDir("", "neogo.wallettest")
require.NoError(t, err)
wallet1Path := path.Join(tmpDir, "multiWallet1.json")
wallet2Path := path.Join(tmpDir, "multiWallet2.json")
t.Cleanup(func() {
os.Remove(wallet1Path)
os.Remove(wallet2Path)
os.RemoveAll(tmpDir)
})
addAccount := func(w string, wif string) {