diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-01-07 03:14:33 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-01-07 03:14:33 +0900 |
| commit | 8e08e8f51882fd8152eec349117f4f8dd7e056f0 (patch) | |
| tree | 00a4baf47a05cfba9529345d7e6d99101687b50a /internal/pkg/exec_test.go | |
| parent | 54da6ce03d33f6503a6753813de825f3d0447903 (diff) | |
internal/pkg: automatic overlay mount on work
This directly submits the upperdir to cache. It is primarily used in bootstrapping where tools are limited and should not be used unless there is a very good reason to.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/exec_test.go')
| -rw-r--r-- | internal/pkg/exec_test.go | 56 |
1 files changed, 49 insertions, 7 deletions
diff --git a/internal/pkg/exec_test.go b/internal/pkg/exec_test.go index d1b88766..680f0ce1 100644 --- a/internal/pkg/exec_test.go +++ b/internal/pkg/exec_test.go @@ -45,7 +45,7 @@ func TestExec(t *testing.T) { msg, 0, nil, - check.MustAbs("/work"), + pkg.AbsWork, []string{"HAKUREI_TEST=1"}, check.MustAbs("/opt/bin/testtool"), []string{"testtool"}, @@ -71,7 +71,7 @@ func TestExec(t *testing.T) { msg, 0, nil, - check.MustAbs("/work"), + pkg.AbsWork, []string{"HAKUREI_TEST=1"}, check.MustAbs("/opt/bin/testtool"), []string{"testtool"}, @@ -90,7 +90,7 @@ func TestExec(t *testing.T) { msg, 0, nil, - check.MustAbs("/work"), + pkg.AbsWork, []string{"HAKUREI_TEST=1"}, check.MustAbs("/opt/bin/testtool"), []string{"testtool"}, @@ -106,7 +106,7 @@ func TestExec(t *testing.T) { msg, 0, nil, - check.MustAbs("/work"), + pkg.AbsWork, nil, check.MustAbs("/opt/bin/testtool"), []string{"testtool"}, @@ -134,7 +134,7 @@ func TestExec(t *testing.T) { msg, 0, &wantChecksum, - check.MustAbs("/work"), + pkg.AbsWork, []string{"HAKUREI_TEST=1"}, check.MustAbs("/opt/bin/testtool"), []string{"testtool", "net"}, @@ -172,7 +172,7 @@ func TestExec(t *testing.T) { msg, 0, nil, - check.MustAbs("/work"), + pkg.AbsWork, []string{"HAKUREI_TEST=1", "HAKUREI_ROOT=1"}, check.MustAbs("/opt/bin/testtool"), []string{"testtool"}, @@ -204,7 +204,7 @@ func TestExec(t *testing.T) { msg, 0, nil, - check.MustAbs("/work"), + pkg.AbsWork, []string{"HAKUREI_TEST=1", "HAKUREI_ROOT=1"}, check.MustAbs("/tmp/bin/testtool"), []string{"testtool"}, @@ -232,6 +232,48 @@ func TestExec(t *testing.T) { testtoolDestroy(t, base, c) }, pkg.MustDecode("_r1IBeMWCkLwQ9Im9w0tV9_CWIOfQlXkkP2CogPHLmZp_AB6W3_8HVZqDV00dNAm")}, + + {"overlay work", 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, + pkg.AbsWork, + []string{"HAKUREI_TEST=1", "HAKUREI_ROOT=1"}, + check.MustAbs("/work/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("/work/", stubArtifact{ + kind: pkg.KindTar, + params: []byte("empty directory"), + cure: func(c *pkg.CureContext) error { + return os.MkdirAll(c.GetWorkDir().String(), 0700) + }, + }), + pkg.ExecContainerPath{ + P: pkg.AbsWork, + A: testtool, + }, + ), ignorePathname, wantChecksumOffline, nil}, + }) + + testtoolDestroy(t, base, c) + }, pkg.MustDecode("-DrfvuB9gUAT-Tgw6V1KjFyosYGMGKJW7KMZFF1Ew8jZ9LJ82FtXf0wTgM3fO0oD")}, }) } |
