aboutsummaryrefslogtreecommitdiffhomepage
path: root/helper/bwrap_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-03-15 01:02:18 +0900
committerOphestra <cat@gensokyo.uk>2025-03-15 01:06:31 +0900
commitf9bf20a3c75d01cf597477231f9bbb61f15cd4fd (patch)
tree702c804f7715b53888ab77b497d216a9cf673f2e /helper/bwrap_test.go
parent73c1a830320636f91a0d15d6d247e88650e81df1 (diff)
helper: rearrange initialisation args
This improves consistency across two different helper implementations. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'helper/bwrap_test.go')
-rw-r--r--helper/bwrap_test.go36
1 files changed, 21 insertions, 15 deletions
diff --git a/helper/bwrap_test.go b/helper/bwrap_test.go
index 4b423564..08b383ea 100644
--- a/helper/bwrap_test.go
+++ b/helper/bwrap_test.go
@@ -33,9 +33,10 @@ func TestBwrap(t *testing.T) {
h := helper.MustNewBwrap(
context.Background(),
- sc, "fortify", false,
- argsWt, argF, nil,
- nil, nil, false,
+ "fortify",
+ argsWt, false,
+ argF, nil,
+ sc, false, nil, nil,
)
if err := h.Start(); !errors.Is(err, os.ErrNotExist) {
@@ -47,9 +48,10 @@ func TestBwrap(t *testing.T) {
t.Run("valid new helper nil check", func(t *testing.T) {
if got := helper.MustNewBwrap(
context.TODO(),
- sc, "fortify", false,
- argsWt, argF, nil,
- nil, nil, false,
+ "fortify",
+ argsWt, false,
+ argF, nil,
+ sc, false, nil, nil,
); got == nil {
t.Errorf("MustNewBwrap(%#v, %#v, %#v) got nil",
sc, argsWt, "fortify")
@@ -68,22 +70,24 @@ func TestBwrap(t *testing.T) {
helper.MustNewBwrap(
context.TODO(),
- &bwrap.Config{Hostname: "\x00"}, "fortify", false,
- nil, argF, nil,
- nil, nil, false,
+ "fortify",
+ nil, false,
+ argF, nil,
+ &bwrap.Config{Hostname: "\x00"}, false, nil, nil,
)
})
t.Run("start without pipes", func(t *testing.T) {
helper.InternalReplaceExecCommand(t)
- c, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
stdout, stderr := new(strings.Builder), new(strings.Builder)
h := helper.MustNewBwrap(
- c, sc, "crash-test-dummy", false,
- nil, argFChecked, func(cmd *exec.Cmd) { cmd.Stdout, cmd.Stderr = stdout, stderr },
- nil, nil, false,
+ ctx, "crash-test-dummy",
+ nil, false,
+ argFChecked, func(cmd *exec.Cmd) { cmd.Stdout, cmd.Stderr = stdout, stderr },
+ sc, false, nil, nil,
)
if err := h.Start(); err != nil {
@@ -101,8 +105,10 @@ func TestBwrap(t *testing.T) {
t.Run("implementation compliance", func(t *testing.T) {
testHelper(t, func(ctx context.Context, cmdF func(cmd *exec.Cmd), stat bool) helper.Helper {
return helper.MustNewBwrap(
- ctx, sc, "crash-test-dummy", false,
- argsWt, argF, cmdF, nil, nil, stat,
+ ctx, "crash-test-dummy",
+ argsWt, stat,
+ argF, cmdF,
+ sc, false, nil, nil,
)
})
})