Skip to content

Commit

Permalink
fix test jitter
Browse files Browse the repository at this point in the history
  • Loading branch information
pldubouilh committed Dec 25, 2019
1 parent 5c9c898 commit e22ef1b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.12
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.12
go-version: 1.13
id: go

- name: Check out code into the Go module directory
Expand Down
22 changes: 16 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ build:
make -C gossa-ui/
go vet && go fmt
CGO_ENABLED=0 go build gossa.go
rm gossa.go
sleep 1 && rm gossa.go

run:
make build
Expand All @@ -13,13 +13,23 @@ run-extra:
make build
./gossa -verb=true -prefix="/fancy-path/" -k=false -symlinks=true test-fixture

test:
timeout 60 make run &
sleep 15 && cp src/gossa_test.go . && go test -run TestNormal
rm gossa_test.go
-killall gossa

test-extra:
timeout 60 make run-extra &
sleep 15 && cp src/gossa_test.go . && go test -run TestExtra
rm gossa_test.go
-killall gossa

ci:
-@cd test-fixture && ln -s ../support .
make build
timeout 15 make run &
sleep 16 && timeout 15 make run-extra &
cp src/gossa_test.go . && go test
rm gossa_test.go
make test
make test-extra


watch:
ls src/* gossa-ui/* | entr -rc make run
Expand Down
15 changes: 5 additions & 10 deletions src/gossa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"regexp"
"strings"
"testing"
"time"
)

func dieMaybe(t *testing.T, err error) {
Expand Down Expand Up @@ -231,18 +230,14 @@ func doTest(t *testing.T, url string, testExtra bool) {
}
}

func TestGetFolder(t *testing.T) {
time.Sleep(6 * time.Second)
func TestNormal(t *testing.T) {
fmt.Println("========== testing normal path ============")
url := "http://127.0.0.1:8001/"
doTest(t, url, false)

doTest(t, "http://127.0.0.1:8001/", false)
fmt.Printf("\r\n=========\r\n")
time.Sleep(10 * time.Second)
}

url = "http://127.0.0.1:8001/fancy-path/"
func TestExtra(t *testing.T) {
fmt.Println("========== testing at fancy path ============")
doTest(t, url, true)

doTest(t, "http://127.0.0.1:8001/fancy-path/", true)
fmt.Printf("\r\n=========\r\n")
}

0 comments on commit e22ef1b

Please sign in to comment.