aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/vfs
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-10-13 04:38:48 +0900
committerOphestra <cat@gensokyo.uk>2025-10-13 04:38:48 +0900
commit7638a44fa613f23434318bdf136723aa010e8638 (patch)
tree7b5270ed4e9b6d7f1ee0f28c58d8077aa1d18005 /container/vfs
parenta14b6535a66cb7ac0fc4827f767ffaee0ce04b57 (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 'container/vfs')
-rw-r--r--container/vfs/mangle_test.go3
-rw-r--r--container/vfs/mountinfo_test.go13
-rw-r--r--container/vfs/unfold_test.go4
3 files changed, 20 insertions, 0 deletions
diff --git a/container/vfs/mangle_test.go b/container/vfs/mangle_test.go
index 2cc65be0..0227e8e1 100644
--- a/container/vfs/mangle_test.go
+++ b/container/vfs/mangle_test.go
@@ -7,6 +7,8 @@ import (
)
func TestUnmangle(t *testing.T) {
+ t.Parallel()
+
testCases := []struct {
want string
sample string
@@ -17,6 +19,7 @@ func TestUnmangle(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.want, func(t *testing.T) {
+ t.Parallel()
got := vfs.Unmangle(tc.sample)
if got != tc.want {
t.Errorf("Unmangle: %q, want %q",
diff --git a/container/vfs/mountinfo_test.go b/container/vfs/mountinfo_test.go
index 7d9b2406..ecca370a 100644
--- a/container/vfs/mountinfo_test.go
+++ b/container/vfs/mountinfo_test.go
@@ -17,6 +17,8 @@ import (
)
func TestDecoderError(t *testing.T) {
+ t.Parallel()
+
testCases := []struct {
name string
err *vfs.DecoderError
@@ -35,13 +37,17 @@ func TestDecoderError(t *testing.T) {
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
+ t.Parallel()
+
t.Run("error", func(t *testing.T) {
+ t.Parallel()
if got := tc.err.Error(); got != tc.want {
t.Errorf("Error: %s, want %s", got, tc.want)
}
})
t.Run("is", func(t *testing.T) {
+ t.Parallel()
if !errors.Is(tc.err, tc.target) {
t.Errorf("Is: unexpected false")
}
@@ -54,6 +60,8 @@ func TestDecoderError(t *testing.T) {
}
func TestMountInfo(t *testing.T) {
+ t.Parallel()
+
testCases := []mountInfoTest{
{"count", sampleMountinfoBase + `
21 20 0:53/ /mnt/test rw,relatime - tmpfs rw
@@ -187,7 +195,10 @@ id 20 0:53 / /mnt/test rw,relatime shared:212 - tmpfs rw
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
+ t.Parallel()
+
t.Run("decode", func(t *testing.T) {
+ t.Parallel()
var got *vfs.MountInfo
d := vfs.NewMountInfoDecoder(strings.NewReader(tc.sample))
err := d.Decode(&got)
@@ -206,6 +217,7 @@ id 20 0:53 / /mnt/test rw,relatime shared:212 - tmpfs rw
})
t.Run("iter", func(t *testing.T) {
+ t.Parallel()
d := vfs.NewMountInfoDecoder(strings.NewReader(tc.sample))
tc.check(t, d, "Entries",
d.Entries(), d.Err)
@@ -217,6 +229,7 @@ id 20 0:53 / /mnt/test rw,relatime shared:212 - tmpfs rw
})
t.Run("yield", func(t *testing.T) {
+ t.Parallel()
d := vfs.NewMountInfoDecoder(strings.NewReader(tc.sample))
v := false
d.Entries()(func(entry *vfs.MountInfoEntry) bool { v = !v; return v })
diff --git a/container/vfs/unfold_test.go b/container/vfs/unfold_test.go
index e04c51a5..3e9d2702 100644
--- a/container/vfs/unfold_test.go
+++ b/container/vfs/unfold_test.go
@@ -10,6 +10,8 @@ import (
)
func TestUnfold(t *testing.T) {
+ t.Parallel()
+
testCases := []struct {
name string
sample string
@@ -50,6 +52,8 @@ func TestUnfold(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
+ t.Parallel()
+
d := vfs.NewMountInfoDecoder(strings.NewReader(tc.sample))
got, err := d.Unfold(tc.target)