treewide: parallel tests
All checks were successful
Test / Create distribution (push) Successful in 25s
Test / Hakurei (push) Successful in 44s
Test / Sandbox (push) Successful in 41s
Test / Hakurei (race detector) (push) Successful in 44s
Test / Sandbox (race detector) (push) Successful in 41s
Test / Hpkg (push) Successful in 41s
Test / Flake checks (push) Successful in 1m24s
All checks were successful
Test / Create distribution (push) Successful in 25s
Test / Hakurei (push) Successful in 44s
Test / Sandbox (push) Successful in 41s
Test / Hakurei (race detector) (push) Successful in 44s
Test / Sandbox (race detector) (push) Successful in 41s
Test / Hpkg (push) Successful in 41s
Test / Flake checks (push) Successful in 1m24s
Most tests already had no global state, however parallel was never enabled. This change enables it for all applicable tests. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -28,6 +28,7 @@ import (
|
||||
)
|
||||
|
||||
func TestApp(t *testing.T) {
|
||||
t.Parallel()
|
||||
msg := message.NewMsg(nil)
|
||||
msg.SwapVerbose(testing.Verbose())
|
||||
|
||||
@@ -445,6 +446,7 @@ func TestApp(t *testing.T) {
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
gr, gw := io.Pipe()
|
||||
|
||||
var gotSys *system.I
|
||||
|
||||
@@ -77,6 +77,7 @@ func checkOpBehaviour(t *testing.T, testCases []opBehaviourTestCase) {
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Helper()
|
||||
t.Parallel()
|
||||
|
||||
wantCallsFull := slices.Concat(wantNewState, tc.toSystem, []stub.Call{{Name: stub.CallSeparator}})
|
||||
if tc.wantErrSystem == nil {
|
||||
|
||||
@@ -13,6 +13,8 @@ import (
|
||||
)
|
||||
|
||||
func TestEnvPaths(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
env *EnvPaths
|
||||
@@ -48,6 +50,7 @@ func TestEnvPaths(t *testing.T) {
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
if tc.wantPanic != "" {
|
||||
defer func() {
|
||||
if r := recover(); r != tc.wantPanic {
|
||||
@@ -66,6 +69,8 @@ func TestEnvPaths(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCopyPaths(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
env map[string]string
|
||||
@@ -84,6 +89,7 @@ func TestCopyPaths(t *testing.T) {
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
if tc.fatal != "" {
|
||||
defer stub.HandleExit(t)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
)
|
||||
|
||||
func TestOutcomeStateValid(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
s *outcomeState
|
||||
@@ -23,6 +25,7 @@ func TestOutcomeStateValid(t *testing.T) {
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
if got := tc.s.valid(); got != tc.want {
|
||||
t.Errorf("valid: %v, want %v", got, tc.want)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import (
|
||||
)
|
||||
|
||||
func TestDeepContainsH(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
basepath string
|
||||
@@ -75,6 +77,7 @@ func TestDeepContainsH(t *testing.T) {
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
if got, err := deepContainsH(tc.basepath, tc.targpath); (err != nil) != tc.wantErr {
|
||||
t.Errorf("deepContainsH() error = %v, wantErr %v", err, tc.wantErr)
|
||||
} else if got != tc.want {
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSpAccountOp(t *testing.T) {
|
||||
t.Parallel()
|
||||
config := hst.Template()
|
||||
|
||||
checkOpBehaviour(t, []opBehaviourTestCase{
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSpParamsOp(t *testing.T) {
|
||||
t.Parallel()
|
||||
config := hst.Template()
|
||||
|
||||
checkOpBehaviour(t, []opBehaviourTestCase{
|
||||
@@ -422,5 +423,5 @@ type invalidFSHost bool
|
||||
func (f invalidFSHost) Valid() bool { return bool(f) }
|
||||
func (invalidFSHost) Path() *check.Absolute { panic("unreachable") }
|
||||
func (invalidFSHost) Host() []*check.Absolute { return []*check.Absolute{nil} }
|
||||
func (invalidFSHost) Apply(z *hst.ApplyState) { panic("unreachable") }
|
||||
func (invalidFSHost) Apply(*hst.ApplyState) { panic("unreachable") }
|
||||
func (invalidFSHost) String() string { panic("unreachable") }
|
||||
|
||||
@@ -7,6 +7,8 @@ const (
|
||||
)
|
||||
|
||||
func TestSysconf(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
t.Run("LOGIN_NAME_MAX", func(t *testing.T) {
|
||||
if got := sysconf(_SC_LOGIN_NAME_MAX); got < _POSIX_LOGIN_NAME_MAX {
|
||||
t.Errorf("sysconf(_SC_LOGIN_NAME_MAX): %d < _POSIX_LOGIN_NAME_MAX", got)
|
||||
|
||||
@@ -6,6 +6,8 @@ import (
|
||||
)
|
||||
|
||||
func TestIsValidUsername(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
t.Run("long", func(t *testing.T) {
|
||||
if isValidUsername(strings.Repeat("a", sysconf(_SC_LOGIN_NAME_MAX))) {
|
||||
t.Errorf("isValidUsername unexpected true")
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
)
|
||||
|
||||
func TestMustCheckPath(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
pathname string
|
||||
@@ -20,6 +22,7 @@ func TestMustCheckPath(t *testing.T) {
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
fatal := func(v ...any) { t.Fatal(append([]any{"invalid call to fatal:"}, v...)...) }
|
||||
if tc.wantFatal != "" {
|
||||
fatal = func(v ...any) {
|
||||
|
||||
Reference in New Issue
Block a user