diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-01-06 20:57:43 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-01-06 20:58:34 +0900 |
| commit | 156096ac987f5ec8be8dbf65332c4d61e675f3cf (patch) | |
| tree | c7f3069fc2e92715107f5ae7ae8841f638e106cf /internal/pkg/exec_test.go | |
| parent | ceb75538cfdaff0a37c7d614fb77aa8c75669600 (diff) | |
internal/pkg: known checksum exec artifact
This optionally attaches an output checksum to an execArtifact and enables host networking for the resulting container.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/exec_test.go')
| -rw-r--r-- | internal/pkg/exec_test.go | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/internal/pkg/exec_test.go b/internal/pkg/exec_test.go index 0ac06010..1b2f84a8 100644 --- a/internal/pkg/exec_test.go +++ b/internal/pkg/exec_test.go @@ -39,6 +39,7 @@ func TestExec(t *testing.T) { t.Context(), msg, 0, + nil, check.MustAbs("/work"), []string{"HAKUREI_TEST=1"}, check.MustAbs("/opt/bin/testtool"), @@ -66,6 +67,7 @@ func TestExec(t *testing.T) { t.Context(), msg, 0, + nil, check.MustAbs("/work"), []string{"HAKUREI_TEST=1"}, check.MustAbs("/opt/bin/testtool"), @@ -84,6 +86,7 @@ func TestExec(t *testing.T) { t.Context(), msg, 0, + nil, check.MustAbs("/work"), []string{"HAKUREI_TEST=1"}, check.MustAbs("/opt/bin/testtool"), @@ -99,6 +102,7 @@ func TestExec(t *testing.T) { t.Context(), msg, 0, + nil, check.MustAbs("/work"), nil, check.MustAbs("/opt/bin/testtool"), @@ -110,6 +114,47 @@ func TestExec(t *testing.T) { testtoolDestroy(t, base, c) }, pkg.MustDecode("7PoPpWLjFPXIymbuIYLZAzOpCYr-2PN4CZ11jFdO-mDlnZNgFO3JyOtK8HW8Jxvm")}, + + {"net", nil, func(t *testing.T, base *check.Absolute, c *pkg.Cache) { + c.SetStrict(true) + testtool, testtoolDestroy := newTesttool() + + msg := message.New(log.New(os.Stderr, "container: ", 0)) + msg.SwapVerbose(testing.Verbose()) + + wantChecksum := pkg.MustDecode( + "a1F_i9PVQI4qMcoHgTQkORuyWLkC1GLIxOhDt2JpU1NGAxWc5VJzdlfRK-PYBh3W", + ) + cureMany(t, c, []cureStep{ + {"container", pkg.NewExec( + t.Context(), + msg, + 0, + &wantChecksum, + check.MustAbs("/work"), + []string{"HAKUREI_TEST=1"}, + check.MustAbs("/opt/bin/testtool"), + []string{"testtool", "net"}, + + pkg.MustPath("/file", newStubFile( + pkg.KindHTTPGet, + pkg.ID{0xfe, 0}, + nil, + nil, nil, + )), + pkg.MustPath("/.hakurei", stubArtifact{ + kind: pkg.KindTar, + params: []byte("empty directory"), + cure: func(c *pkg.CureContext) error { + return os.MkdirAll(c.GetWorkDir().String(), 0700) + }, + }), + pkg.MustPath("/opt", testtool), + ), ignorePathname, wantChecksum, nil}, + }) + + testtoolDestroy(t, base, c) + }, pkg.MustDecode("bBQVFIt0FnOulljgpLnGtuzHSFgwiCMjc4pmc4rHRqXKQ60Q5aBVYp5f6aH9VdZi")}, }) } |
