aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/exec_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-05-12 19:45:25 +0900
committerOphestra <cat@gensokyo.uk>2026-05-12 19:45:25 +0900
commita167c1aba54a25665654036914be34c33087207c (patch)
treee4e9c0010dcead6f792c356c0c546ffee3e83e3c /internal/pkg/exec_test.go
parenta6008ef68b38d044e2082f1ad0475849ea098b49 (diff)
internal/pkg: hold artifact in DCE
This is significantly slower but enables much better error reporting. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/exec_test.go')
-rw-r--r--internal/pkg/exec_test.go20
1 files changed, 9 insertions, 11 deletions
diff --git a/internal/pkg/exec_test.go b/internal/pkg/exec_test.go
index f9d4158e..cab7a9ca 100644
--- a/internal/pkg/exec_test.go
+++ b/internal/pkg/exec_test.go
@@ -11,7 +11,6 @@ import (
"path/filepath"
"slices"
"testing"
- "unique"
"hakurei.app/check"
"hakurei.app/container"
@@ -50,6 +49,13 @@ func TestExec(t *testing.T) {
"check": {Mode: 0400, Data: []byte{0}},
}
wantOfflineEncode := pkg.Encode(wantOffline.hash())
+ failingArtifact := &stubArtifact{
+ kind: pkg.KindTar,
+ params: []byte("doomed artifact"),
+ cure: func(t *pkg.TContext) error {
+ return stub.UniqueError(0xcafe)
+ },
+ }
checkWithCache(t, []cacheTestCase{
{"offline", pkg.CValidateKnown | checkDestroySubstitutes, nil, func(t *testing.T, base *check.Absolute, c *pkg.Cache) {
@@ -86,18 +92,10 @@ func TestExec(t *testing.T) {
check.MustAbs("/opt/bin/testtool"),
[]string{"testtool"},
- pkg.MustPath("/proc/nonexistent", false, &stubArtifact{
- kind: pkg.KindTar,
- params: []byte("doomed artifact"),
- cure: func(t *pkg.TContext) error {
- return stub.UniqueError(0xcafe)
- },
- }),
+ pkg.MustPath("/proc/nonexistent", false, failingArtifact),
), nil, nil, &pkg.DependencyCureError{
{
- Ident: unique.Make(pkg.ID(pkg.MustDecode(
- "Sowo6oZRmG6xVtUaxB6bDWZhVsqAJsIJWUp0OPKlE103cY0lodx7dem8J-qQF0Z1",
- ))),
+ A: failingArtifact,
Err: stub.UniqueError(0xcafe),
},
}},