e2e: have e2e use ci.Parallel

This is a followup to having tests run in serial in CI.

The e2e package isn't in CI, but lets use the helper anyway
so we can setup semgrep rules covering the entire repository.
This commit is contained in:
Seth Hoenig
2022-03-17 08:37:34 -05:00
parent 3695901441
commit 7e6767ddf8
3 changed files with 9 additions and 7 deletions

View File

@@ -14,6 +14,7 @@ import (
"time"
"github.com/hashicorp/nomad/api"
"github.com/hashicorp/nomad/ci"
"github.com/hashicorp/nomad/client/state"
"github.com/hashicorp/nomad/e2e/e2eutil"
"github.com/hashicorp/nomad/e2e/execagent"
@@ -82,7 +83,7 @@ func getPID(client *api.Client, alloc *api.Allocation, path string) (int, error)
// loop to assert Nomad is crash safe.
func (tc *ClientStateTC) TestClientState_Kill(f *framework.F) {
t := f.T()
t.Parallel()
ci.Parallel(t)
serverOut := testlog.NewPrefixWriter(t, "SERVER: ")
clientOut := testlog.NewPrefixWriter(t, "CLIENT: ")
@@ -223,7 +224,7 @@ func (tc *ClientStateTC) TestClientState_Kill(f *framework.F) {
// in a tight loop to assert Nomad is crash safe while a task is restarting.
func (tc *ClientStateTC) TestClientState_KillDuringRestart(f *framework.F) {
t := f.T()
t.Parallel()
ci.Parallel(t)
serverOut := testlog.NewPrefixWriter(t, "SERVER: ")
clientOut := testlog.NewPrefixWriter(t, "CLIENT: ")
@@ -345,7 +346,7 @@ func (tc *ClientStateTC) TestClientState_KillDuringRestart(f *framework.F) {
// assert it recovers.
func (tc *ClientStateTC) TestClientState_Corrupt(f *framework.F) {
t := f.T()
t.Parallel()
ci.Parallel(t)
serverOut := testlog.NewPrefixWriter(t, "SERVER: ")
clientOut := testlog.NewPrefixWriter(t, "CLIENT: ")

View File

@@ -8,6 +8,7 @@ import (
"strings"
"testing"
"github.com/hashicorp/nomad/ci"
"github.com/stretchr/testify/require"
)
@@ -212,7 +213,7 @@ func (f *Framework) runCase(t *testing.T, s *TestSuite, c TestCase) {
t.Run(c.Name(), func(t *testing.T) {
// If the TestSuite has Parallel set, all cases run in parallel
if s.Parallel {
t.Parallel()
ci.Parallel(t)
}
f := newF(t)

View File

@@ -119,7 +119,7 @@ func (tc *UpgradePathTC) TestRawExecTaskUpgrade(f *framework.F) {
for _, ver := range nomadVersions {
ver := ver
f.T().Run(ver, func(t *testing.T) {
t.Parallel()
ci.Parallel(t)
tc.testUpgradeForJob(t, ver, "nomad09upgrade/rawexec.nomad")
})
}
@@ -129,7 +129,7 @@ func (tc *UpgradePathTC) TestExecTaskUpgrade(f *framework.F) {
for _, ver := range nomadVersions {
ver := ver
f.T().Run(ver, func(t *testing.T) {
t.Parallel()
ci.Parallel(t)
tc.testUpgradeForJob(t, ver, "nomad09upgrade/exec.nomad")
})
}
@@ -139,7 +139,7 @@ func (tc *UpgradePathTC) TestDockerTaskUpgrade(f *framework.F) {
for _, ver := range nomadVersions {
ver := ver
f.T().Run(ver, func(t *testing.T) {
t.Parallel()
ci.Parallel(t)
tc.testUpgradeForJob(t, ver, "nomad09upgrade/docker.nomad")
})
}