Files
nomad/api/internal/testutil/slow.go
Seth Hoenig 12034f90a3 api: make api tests fast and more concurrency safe (#15543)
This PR tries to make API tests run fast, as an experiment to later apply
to all packages. Key changes include

- Swapping freeport for test/portal for port allocations
- Swappng some uses of WaitForResult with test/wait
- Turning on parallelism in api/testutil/slow.go
- Switching to custom public runner (32 vcpu)

There's also chunk of cleanup brought in for the ride
2022-12-16 12:25:28 -06:00

26 lines
516 B
Go

package testutil
import (
"os"
"strconv"
"testing"
)
// Copy of ci/slow.go for API.
// SkipSlow skips a slow test unless NOMAD_SLOW_TEST is set to a true value.
func SkipSlow(t *testing.T, reason string) {
value := os.Getenv("NOMAD_SLOW_TEST")
run, err := strconv.ParseBool(value)
if !run || err != nil {
t.Skipf("Skipping slow test: %s", reason)
}
}
// Parallel runs t in parallel.
//
// The API package has been vetted to be concurrency safe (ish).
func Parallel(t *testing.T) {
t.Parallel() // :)
}