Skip to content

Commit

Permalink
Fix test path
Browse files Browse the repository at this point in the history
  • Loading branch information
danawoodman committed Feb 27, 2024
1 parent 8995725 commit de2ac77
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 14 additions & 6 deletions test/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package test

import (
"bytes"
"fmt"
"io"
"os"
"os/exec"
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit de2ac77

Please sign in to comment.