Skip to content

Commit 1d2ab7e

Browse files
committed
[FAB-1481] Clean up created files after test
Change-Id: Id9323d1cfc7c55e389468414d87c9362312ebc95 Signed-off-by: Gabor Hosszu <[email protected]>
1 parent f9b68d4 commit 1d2ab7e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

orderer/sbft/main/network_test.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ import (
4545

4646
const keyfile = "testdata/key.pem"
4747
const maindir = "github.com/hyperledger/fabric/orderer/sbft/main"
48-
const mainexe = "main"
48+
49+
var mainexe = os.TempDir() + "/" + "sbft"
4950

5051
type peer struct {
5152
id uint64
@@ -67,12 +68,16 @@ func skipInShortMode(t *testing.T) {
6768
}
6869

6970
func build() {
70-
buildcmd := exec.Command("go", "build", maindir)
71+
buildcmd := exec.Command("go", "build", "-o", mainexe, maindir)
7172
buildcmd.Stdout = os.Stdout
7273
buildcmd.Stderr = os.Stderr
7374
panicOnError(buildcmd.Run())
7475
}
7576

77+
func deleteExe() {
78+
panicOnError(os.Remove(mainexe))
79+
}
80+
7681
func install() {
7782
installcmd := exec.Command("go", "install", maindir)
7883
installcmd.Stdout = os.Stdout
@@ -82,8 +87,8 @@ func install() {
8287

8388
func TestMain(m *testing.M) {
8489
build()
85-
install()
8690
code := m.Run()
91+
deleteExe()
8792
os.Exit(code)
8893
}
8994

0 commit comments

Comments
 (0)