aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/exec_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-01-06 23:34:43 +0900
committerOphestra <cat@gensokyo.uk>2026-01-06 23:45:08 +0900
commit0df87ab1117bf4da5163ad486a82628f1bada7ed (patch)
tree48745fe27c4c3694c1313bb9030188458fbdd328 /internal/pkg/exec_test.go
parentaa0a949cefd8c1a1519d892f87aac3119389e271 (diff)
internal/pkg: automatic overlay mount on tmp
This sets up the last Artifact to target /tmp as a writable overlay mount backed by the host side temp directory. This is useful for an Artifact containing source code to be built for another Artifact for example. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/exec_test.go')
-rw-r--r--internal/pkg/exec_test.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/internal/pkg/exec_test.go b/internal/pkg/exec_test.go
index 76bb7566..d1b88766 100644
--- a/internal/pkg/exec_test.go
+++ b/internal/pkg/exec_test.go
@@ -11,6 +11,7 @@ import (
"testing"
"hakurei.app/container/check"
+ "hakurei.app/container/fhs"
"hakurei.app/container/stub"
"hakurei.app/hst"
"hakurei.app/internal/pkg"
@@ -189,6 +190,48 @@ func TestExec(t *testing.T) {
testtoolDestroy(t, base, c)
}, pkg.MustDecode("gFT9kprYBqEJKifJIl2sHn_3TgULWVLTU4DrYAHiGcRmcdFRZ0YtjiROW820cAEc")},
+
+ {"overlay temp", 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())
+
+ cureMany(t, c, []cureStep{
+ {"container", pkg.NewExec(
+ t.Context(),
+ msg,
+ 0,
+ nil,
+ check.MustAbs("/work"),
+ []string{"HAKUREI_TEST=1", "HAKUREI_ROOT=1"},
+ check.MustAbs("/tmp/bin/testtool"),
+ []string{"testtool"},
+
+ pkg.MustPath("/", stubArtifact{
+ kind: pkg.KindTar,
+ params: []byte("empty directory"),
+ cure: func(c *pkg.CureContext) error {
+ return os.MkdirAll(c.GetWorkDir().String(), 0700)
+ },
+ }),
+ pkg.MustPath("/tmp/", stubArtifact{
+ kind: pkg.KindTar,
+ params: []byte("empty directory"),
+ cure: func(c *pkg.CureContext) error {
+ return os.MkdirAll(c.GetWorkDir().String(), 0700)
+ },
+ }),
+ pkg.ExecContainerPath{
+ P: fhs.AbsTmp,
+ A: testtool,
+ },
+ ), ignorePathname, wantChecksumOffline, nil},
+ })
+
+ testtoolDestroy(t, base, c)
+ }, pkg.MustDecode("_r1IBeMWCkLwQ9Im9w0tV9_CWIOfQlXkkP2CogPHLmZp_AB6W3_8HVZqDV00dNAm")},
})
}