Skip to content

Commit 42c8ea0

Browse files
committed
refactor: Little fixup to cleaner tests
Signed-off-by: Justin Chadwell <justin@unikraft.com>
1 parent eb29345 commit 42c8ea0

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

cmd/unikraft/volumes_test.go

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package main
77

88
import (
99
"regexp"
10-
"slices"
1110
"testing"
1211
)
1312

@@ -91,15 +90,13 @@ func volumesTests(t *testing.T, r *testRunner) {
9190
t.Run("dir", func(t *testing.T) {
9291
r.
9392
online().
94-
withCleaners(
95-
[]cleaner{
96-
// free size differs on every run
97-
{
98-
pattern: regexp.MustCompile(`free=[0-9]+.?[0-9]*MiB`),
99-
repl: "free=10MiB",
100-
},
93+
withCleaners([]cleaner{
94+
// free size differs on every run
95+
{
96+
pattern: regexp.MustCompile(`free=[0-9]+.?[0-9]*MiB`),
97+
repl: "free=10MiB",
10198
},
102-
).
99+
}).
103100
withContext(map[string]string{
104101
"hello.txt": "hello from volume import\n",
105102
}).
@@ -115,13 +112,14 @@ func volumesTests(t *testing.T, r *testRunner) {
115112
t.Run("serve", func(t *testing.T) {
116113
r.
117114
online().
118-
withCleaners(
119-
append(slices.Clone(instanceCleaners), cleaner{
115+
withCleaners(instanceCleaners).
116+
withCleaners([]cleaner{
117+
{
120118
// free size differs on every run
121119
pattern: regexp.MustCompile(`free=[0-9]+.?[0-9]*MiB`),
122120
repl: "free=50MiB",
123-
}),
124-
).
121+
},
122+
}).
125123
withContext(map[string]string{
126124
"index.html": "<html><body>hello from volume import</body></html>\n",
127125
}).

0 commit comments

Comments
 (0)