diff --git a/testing/scenarios/common.go b/testing/scenarios/common.go index 8d629c59..dc54105a 100644 --- a/testing/scenarios/common.go +++ b/testing/scenarios/common.go @@ -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") diff --git a/testing/scenarios/main_test.go b/testing/scenarios/main_test.go new file mode 100644 index 00000000..269081c6 --- /dev/null +++ b/testing/scenarios/main_test.go @@ -0,0 +1,12 @@ +package scenarios + +import ( + "testing" +) + +func TestMain(m *testing.M) { + genTestBinaryPath() + defer testBinaryCleanFn() + + m.Run() +}