mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 02:15:43 +03:00
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
26 lines
516 B
Go
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() // :)
|
|
}
|