mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-29 12:01:27 +00:00
Test: Remove temporary directory afterwards (#4045)
This commit is contained in:
parent
034a485afe
commit
ce8c415d43
|
@ -96,6 +96,7 @@ func InitializeServerConfig(config *core.Config) (*exec.Cmd, error) {
|
|||
|
||||
var (
|
||||
testBinaryPath string
|
||||
testBinaryCleanFn func()
|
||||
testBinaryPathGen sync.Once
|
||||
)
|
||||
|
||||
|
@ -108,6 +109,7 @@ func genTestBinaryPath() {
|
|||
return err
|
||||
}
|
||||
tempDir = dir
|
||||
testBinaryCleanFn = func() { os.RemoveAll(dir) }
|
||||
return nil
|
||||
}))
|
||||
file := filepath.Join(tempDir, "xray.test")
|
||||
|
|
12
testing/scenarios/main_test.go
Normal file
12
testing/scenarios/main_test.go
Normal file
|
@ -0,0 +1,12 @@
|
|||
package scenarios
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
genTestBinaryPath()
|
||||
defer testBinaryCleanFn()
|
||||
|
||||
m.Run()
|
||||
}
|
Loading…
Reference in a new issue