optimize test execution time by only building the client once + add Makefile target for action tests

This commit is contained in:
David Dworken 2022-04-15 18:12:26 -07:00
parent 682a063e95
commit 5b59141c3a
2 changed files with 10 additions and 2 deletions

View File

@ -1,9 +1,13 @@
forcetest:
go clean -testcache
HISHTORY_TEST=1 go test -p 1 ./...
test:
HISHTORY_TEST=1 go test -p 1 ./...
acttest:
act push -j test
release:
expr `cat VERSION` + 1 > VERSION
git add VERSION

View File

@ -23,6 +23,11 @@ import (
func TestMain(m *testing.M) {
defer shared.RunTestServer()()
cmd := exec.Command("go", "build", "-o", "/tmp/client")
err := cmd.Run()
if err != nil {
panic(fmt.Sprintf("failed to build client: %v", err))
}
m.Run()
}
@ -163,8 +168,7 @@ func TestIntegrationWithNewDevice(t *testing.T) {
}
func installHishtory(t *testing.T, userSecret string) string {
out := RunInteractiveBashCommands(t, `go build -o /tmp/client
/tmp/client install `+userSecret)
out := RunInteractiveBashCommands(t, `/tmp/client install `+userSecret)
r := regexp.MustCompile(`Setting secret hishtory key to (.*)`)
matches := r.FindStringSubmatch(out)
if len(matches) != 2 {