Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: support cross-platform config file #291

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
regist t clean up
  • Loading branch information
xiantang committed Jun 5, 2022
commit 40d7d4eeff960515bfef9ac18fd9feb365b9c8a5
21 changes: 3 additions & 18 deletions runner/engine_test.go
Original file line number Diff line number Diff line change
@@ -122,9 +122,6 @@ func TestRebuild(t *testing.T) {
t.Logf("port: %d", port)

tmpDir := initTestEnv(t, port)
defer t.Cleanup(func() {
os.RemoveAll(tmpDir)
})
// change dir to tmpDir
err := os.Chdir(tmpDir)
if err != nil {
@@ -213,9 +210,6 @@ func TestCtrlCWhenHaveKillDelay(t *testing.T) {
t.Logf("port: %d", port)

tmpDir := initTestEnv(t, port)
defer t.Cleanup(func() {
os.RemoveAll(tmpDir)
})
// change dir to tmpDir
err := os.Chdir(tmpDir)
if err != nil {
@@ -260,9 +254,6 @@ func TestCtrlCWhenREngineIsRunning(t *testing.T) {
t.Logf("port: %d", port)

tmpDir := initTestEnv(t, port)
defer t.Cleanup(func() {
os.RemoveAll(tmpDir)
})
// change dir to tmpDir
err := os.Chdir(tmpDir)
if err != nil {
@@ -322,9 +313,6 @@ func TestRun(t *testing.T) {
t.Logf("port: %d", port)

tmpDir := initTestEnv(t, port)
defer t.Cleanup(func() {
os.RemoveAll(tmpDir)
})
// change dir to tmpDir
err := os.Chdir(tmpDir)
if err != nil {
@@ -371,6 +359,9 @@ func checkPortHaveBeenUsed(port int) bool {

func initTestEnv(t *testing.T, port int) string {
tempDir := t.TempDir()
t.Cleanup(func() {
os.RemoveAll(tempDir)
})
t.Logf("tempDir: %s", tempDir)
// generate golang code to tempdir
err := generateGoCode(tempDir, port)
@@ -422,9 +413,6 @@ func TestRebuildWhenRunCmdUsingDLV(t *testing.T) {
f()
t.Logf("port: %d", port)
tmpDir := initTestEnv(t, port)
defer t.Cleanup(func() {
os.RemoveAll(tmpDir)
})
// change dir to tmpDir
err := os.Chdir(tmpDir)
if err != nil {
@@ -484,9 +472,6 @@ func TestWriteDefaultConfig(t *testing.T) {
t.Logf("port: %d", port)

tmpDir := initTestEnv(t, port)
defer t.Cleanup(func() {
os.RemoveAll(tmpDir)
})
// change dir to tmpDir
if err := os.Chdir(tmpDir); err != nil {
t.Fatal(err)