GeezerVison is showing github.com — Recycle keystore file in unit test · CovenantSQL/CovenantSQL@eea91b5
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: client/helper_test.go +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -201,9 +201,9 @@ func initNode() (cleanupFunc func(), tempDir string, server *rpc.Server, err err | 201 | 201 | // init conf | 202 | 202 | _, testFile, _, _ := runtime.Caller(0) | 203 | 203 | pubKeyStoreFile := filepath.Join(tempDir, PubKeyStorePath+"_dht") | 204 | | - os.Remove(pubKeyStoreFile) | | 204 | + utils.RemoveAll(pubKeyStoreFile + "*") | 205 | 205 | clientPubKeyStoreFile := filepath.Join(tempDir, PubKeyStorePath+"_c") | 206 | | - os.Remove(clientPubKeyStoreFile) | | 206 | + utils.RemoveAll(clientPubKeyStoreFile + "*") | 207 | 207 | dupConfFile := filepath.Join(tempDir, "config.yaml") | 208 | 208 | confFile := filepath.Join(filepath.Dir(testFile), "../test/node_standalone/config.yaml") | 209 | 209 | if err = utils.DupConf(confFile, dupConfFile); err != nil { | |
Collapse file Copy file name to clipboardExpand all lines: cmd/cql-minerd/node.go +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -18,7 +18,6 @@ package main | 18 | 18 |
| 19 | 19 | import ( | 20 | 20 | "fmt" | 21 | | - "os" | 22 | 21 | "syscall" | 23 | 22 | "time" | 24 | 23 |
| @@ -28,6 +27,7 @@ import ( | 28 | 27 | "github.com/CovenantSQL/CovenantSQL/crypto/kms" | 29 | 28 | "github.com/CovenantSQL/CovenantSQL/route" | 30 | 29 | "github.com/CovenantSQL/CovenantSQL/rpc" | | 30 | + "github.com/CovenantSQL/CovenantSQL/utils" | 31 | 31 | "github.com/CovenantSQL/CovenantSQL/utils/log" | 32 | 32 | ) | 33 | 33 |
| @@ -69,7 +69,7 @@ func initNode() (server *rpc.Server, err error) { | 69 | 69 | } | 70 | 70 |
| 71 | 71 | func createServer(privateKeyPath, pubKeyStorePath string, masterKey []byte, listenAddr string) (server *rpc.Server, err error) { | 72 | | - os.Remove(pubKeyStorePath) | | 72 | + utils.RemoveAll(pubKeyStorePath + "*") | 73 | 73 |
| 74 | 74 | server = rpc.NewServer() | 75 | 75 | if err != nil { | |
Collapse file Copy file name to clipboardExpand all lines: cmd/cqld/bench_test.go +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -63,7 +63,7 @@ func start3BPs() { | 63 | 63 | var cmd *utils.CMD | 64 | 64 | os.Remove(FJ(testWorkingDir, "./node_0/chain.db")) | 65 | 65 | os.Remove(FJ(testWorkingDir, "./node_0/dht.db")) | 66 | | - os.Remove(FJ(testWorkingDir, "./node_0/public.keystore")) | | 66 | + utils.RemoveAll(FJ(testWorkingDir, "./node_0/public.keystore*")) | 67 | 67 | if cmd, err = utils.RunCommandNB( | 68 | 68 | FJ(baseDir, "./bin/cqld.test"), | 69 | 69 | []string{"-config", FJ(testWorkingDir, "./node_0/config.yaml"), | @@ -77,7 +77,7 @@ func start3BPs() { | 77 | 77 | } | 78 | 78 | os.Remove(FJ(testWorkingDir, "./node_1/chain.db")) | 79 | 79 | os.Remove(FJ(testWorkingDir, "./node_1/dht.db")) | 80 | | - os.Remove(FJ(testWorkingDir, "./node_1/public.keystore")) | | 80 | + utils.RemoveAll(FJ(testWorkingDir, "./node_1/public.keystore*")) | 81 | 81 | if cmd, err = utils.RunCommandNB( | 82 | 82 | FJ(baseDir, "./bin/cqld.test"), | 83 | 83 | []string{"-config", FJ(testWorkingDir, "./node_1/config.yaml"), | @@ -91,7 +91,7 @@ func start3BPs() { | 91 | 91 | } | 92 | 92 | os.Remove(FJ(testWorkingDir, "./node_2/chain.db")) | 93 | 93 | os.Remove(FJ(testWorkingDir, "./node_2/dht.db")) | 94 | | - os.Remove(FJ(testWorkingDir, "./node_2/public.keystore")) | | 94 | + utils.RemoveAll(FJ(testWorkingDir, "./node_2/public.keystore*")) | 95 | 95 | if cmd, err = utils.RunCommandNB( | 96 | 96 | FJ(baseDir, "./bin/cqld.test"), | 97 | 97 | []string{"-config", FJ(testWorkingDir, "./node_2/config.yaml"), | @@ -104,7 +104,7 @@ func start3BPs() { | 104 | 104 | log.Errorf("start node failed: %v", err) | 105 | 105 | } | 106 | 106 | os.Remove(FJ(testWorkingDir, "./node_c/dht.db")) | 107 | | - os.Remove(FJ(testWorkingDir, "./node_c/public.keystore")) | | 107 | + utils.RemoveAll(FJ(testWorkingDir, "./node_c/public.keystore*")) | 108 | 108 | } | 109 | 109 |
| 110 | 110 | func stopNodes() { | |
|