From de2ac771b1575f04bd835252a0c0d776d366483c Mon Sep 17 00:00:00 2001 From: Dana Woodman Date: Mon, 26 Feb 2024 19:05:03 -0800 Subject: [PATCH] Fix test path --- .github/workflows/release.yml | 8 ++++++-- test/e2e_test.go | 20 ++++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 53e7f49..8ef990b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,13 +22,17 @@ jobs: go-version-file: "go.mod" - name: Build for tests - run: make install + run: make build - name: Run unit tests run: make test-unit - name: Run e2e tests - run: make test-e2e + run: | + pwd + ls -la + ls -la .. + make test-e2e - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 diff --git a/test/e2e_test.go b/test/e2e_test.go index 8873686..d49e9f4 100644 --- a/test/e2e_test.go +++ b/test/e2e_test.go @@ -2,6 +2,7 @@ package test import ( "bytes" + "fmt" "io" "os" "os/exec" @@ -72,9 +73,16 @@ func TestCng(t *testing.T) { // todo: ignore files in node_modules / ,git by default } - curDir, err := os.Getwd() - assert.NoError(t, err) - binDir := path.Join(curDir, "..", "dist") + curDir := os.Getenv("GITHUB_WORKSPACE") + fmt.Println("github dir", curDir) + if curDir == "" { + wd, err := os.Getwd() + assert.NoError(t, err) + curDir = path.Join(wd, "..") + } + fmt.Println("curDir", curDir) + binDir := path.Join(curDir, "dist") + fmt.Println("binDir", binDir) for _, test := range tests { t.Run(test.name, func(t *testing.T) { @@ -103,15 +111,15 @@ func TestCng(t *testing.T) { // wait for the process to start // anything less than about 100ms and the process won't have time to start - time.Sleep(200 * time.Millisecond) + time.Sleep(150 * time.Millisecond) if test.steps != nil { test.steps(func(path string) { - write(t, dir, path, "content", 500) + write(t, dir, path, "content", 50) }) } - time.Sleep(100 * time.Millisecond) + time.Sleep(50 * time.Millisecond) // Send SIGINT to the process err = cmd.Process.Signal(os.Interrupt)