diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-10-13 04:38:48 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-10-13 04:38:48 +0900 |
| commit | 7638a44fa613f23434318bdf136723aa010e8638 (patch) | |
| tree | 7b5270ed4e9b6d7f1ee0f28c58d8077aa1d18005 /hst/fs_test.go | |
| parent | a14b6535a66cb7ac0fc4827f767ffaee0ce04b57 (diff) | |
treewide: parallel tests
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>
Diffstat (limited to 'hst/fs_test.go')
| -rw-r--r-- | hst/fs_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/hst/fs_test.go b/hst/fs_test.go index 8350be54..10e075be 100644 --- a/hst/fs_test.go +++ b/hst/fs_test.go @@ -15,6 +15,8 @@ import ( ) func TestFilesystemConfigJSON(t *testing.T) { + t.Parallel() + testCases := []struct { name string want hst.FilesystemConfigJSON @@ -86,7 +88,10 @@ func TestFilesystemConfigJSON(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + t.Parallel() + t.Run("marshal", func(t *testing.T) { + t.Parallel() wantErr := tc.wantErr if errors.As(wantErr, new(hst.FSTypeError)) { // for unsupported implementation tc @@ -122,6 +127,7 @@ func TestFilesystemConfigJSON(t *testing.T) { }) t.Run("unmarshal", func(t *testing.T) { + t.Parallel() if tc.data == "\x00" && tc.sData == "\x00" { if errors.As(tc.wantErr, new(hst.FSImplError)) { // this error is only returned on marshal @@ -163,6 +169,8 @@ func TestFilesystemConfigJSON(t *testing.T) { } t.Run("valid", func(t *testing.T) { + t.Parallel() + if got := (*hst.FilesystemConfigJSON).Valid(nil); got { t.Errorf("Valid: %v, want false", got) } @@ -177,6 +185,7 @@ func TestFilesystemConfigJSON(t *testing.T) { }) t.Run("passthrough", func(t *testing.T) { + t.Parallel() if err := new(hst.FilesystemConfigJSON).UnmarshalJSON(make([]byte, 0)); err == nil { t.Errorf("UnmarshalJSON: error = %v", err) } @@ -184,7 +193,10 @@ func TestFilesystemConfigJSON(t *testing.T) { } func TestFSErrors(t *testing.T) { + t.Parallel() + t.Run("type", func(t *testing.T) { + t.Parallel() want := `invalid filesystem type "cat"` if got := hst.FSTypeError("cat").Error(); got != want { t.Errorf("Error: %q, want %q", got, want) @@ -192,6 +204,8 @@ func TestFSErrors(t *testing.T) { }) t.Run("impl", func(t *testing.T) { + t.Parallel() + testCases := []struct { name string val hst.FilesystemConfig @@ -205,6 +219,7 @@ func TestFSErrors(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + t.Parallel() err := hst.FSImplError{Value: tc.val} if got := err.Error(); got != tc.want { t.Errorf("Error: %q, want %q", got, tc.want) @@ -242,13 +257,17 @@ type fsTestCase struct { func checkFs(t *testing.T, testCases []fsTestCase) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + t.Parallel() + t.Run("valid", func(t *testing.T) { + t.Parallel() if got := tc.fs.Valid(); got != tc.valid { t.Errorf("Valid: %v, want %v", got, tc.valid) } }) t.Run("ops", func(t *testing.T) { + t.Parallel() ops := new(container.Ops) tc.fs.Apply(&hst.ApplyState{AutoEtcPrefix: ":3", Ops: opsAdapter{ops}}) if !reflect.DeepEqual(ops, &tc.ops) { @@ -265,18 +284,21 @@ func checkFs(t *testing.T, testCases []fsTestCase) { }) t.Run("path", func(t *testing.T) { + t.Parallel() if got := tc.fs.Path(); !reflect.DeepEqual(got, tc.path) { t.Errorf("Target: %q, want %q", got, tc.path) } }) t.Run("host", func(t *testing.T) { + t.Parallel() if got := tc.fs.Host(); !reflect.DeepEqual(got, tc.host) { t.Errorf("Host: %q, want %q", got, tc.host) } }) t.Run("string", func(t *testing.T) { + t.Parallel() if tc.str == "\x00" { return } |
