internal/pkg: hold artifact in DCE
All checks were successful
Test / Create distribution (push) Successful in 1m3s
Test / Sandbox (push) Successful in 2m42s
Test / ShareFS (push) Successful in 3m43s
Test / Hakurei (push) Successful in 3m56s
Test / Sandbox (race detector) (push) Successful in 5m20s
Test / Hakurei (race detector) (push) Successful in 6m24s
Test / Flake checks (push) Successful in 1m21s
All checks were successful
Test / Create distribution (push) Successful in 1m3s
Test / Sandbox (push) Successful in 2m42s
Test / ShareFS (push) Successful in 3m43s
Test / Hakurei (push) Successful in 3m56s
Test / Sandbox (race detector) (push) Successful in 5m20s
Test / Hakurei (race detector) (push) Successful in 6m24s
Test / Flake checks (push) Successful in 1m21s
This is significantly slower but enables much better error reporting. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -651,6 +651,15 @@ func TestCache(t *testing.T) {
|
||||
"identifier",
|
||||
"cafebabecafebabecafebabecafebabecafebabecafebabecafebabecafebabe",
|
||||
)
|
||||
failingFile := newStubFile(
|
||||
pkg.KindHTTPGet,
|
||||
pkg.ID{0xff, 3},
|
||||
nil,
|
||||
nil, struct {
|
||||
_ []byte
|
||||
stub.UniqueError
|
||||
}{UniqueError: 0xbad},
|
||||
)
|
||||
|
||||
cureMany(t, c, []cureStep{
|
||||
{"initial file", newStubFile(
|
||||
@@ -732,22 +741,14 @@ func TestCache(t *testing.T) {
|
||||
{"noncomparable error", &stubArtifactF{
|
||||
kind: pkg.KindExec,
|
||||
params: []byte("artifact with dependency returning noncomparable error"),
|
||||
deps: []pkg.Artifact{newStubFile(
|
||||
pkg.KindHTTPGet,
|
||||
pkg.ID{0xff, 3},
|
||||
nil,
|
||||
nil, struct {
|
||||
_ []byte
|
||||
stub.UniqueError
|
||||
}{UniqueError: 0xbad},
|
||||
)},
|
||||
deps: []pkg.Artifact{failingFile},
|
||||
|
||||
cure: func(f *pkg.FContext) error {
|
||||
panic("attempting to cure impossible artifact")
|
||||
},
|
||||
}, nil, nil, &pkg.DependencyCureError{
|
||||
{
|
||||
Ident: unique.Make(pkg.ID{0xff, 3}),
|
||||
A: failingFile,
|
||||
Err: struct {
|
||||
_ []byte
|
||||
stub.UniqueError
|
||||
@@ -1511,6 +1512,12 @@ errors during scrub:
|
||||
func TestDependencyCureError(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
makeIdent := func(ident ...byte) pkg.Artifact {
|
||||
var a overrideIdent
|
||||
copy(a.id[:], ident)
|
||||
return a
|
||||
}
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
err pkg.DependencyCureError
|
||||
@@ -1518,51 +1525,51 @@ func TestDependencyCureError(t *testing.T) {
|
||||
unwrap []error
|
||||
}{
|
||||
{"simple", pkg.DependencyCureError{
|
||||
{Ident: unique.Make(pkg.ID{0xff, 9}), Err: stub.UniqueError(0xbad09)},
|
||||
{Ident: unique.Make(pkg.ID{0xff, 0}), Err: stub.UniqueError(0xbad00)},
|
||||
{Ident: unique.Make(pkg.ID{0xff, 0xf}), Err: stub.UniqueError(0xbad0f)},
|
||||
{Ident: unique.Make(pkg.ID{0xff, 1}), Err: stub.UniqueError(0xbad01)},
|
||||
{A: makeIdent(0xff, 9), Err: stub.UniqueError(0xbad09)},
|
||||
{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
||||
{A: makeIdent(0xff, 0xf), Err: stub.UniqueError(0xbad0f)},
|
||||
{A: makeIdent(0xff, 1), Err: stub.UniqueError(0xbad01)},
|
||||
}, `errors curing dependencies:
|
||||
_wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765184 injected by the test suite
|
||||
_wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765185 injected by the test suite
|
||||
_wkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765193 injected by the test suite
|
||||
_w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765199 injected by the test suite`, []error{
|
||||
&pkg.CureError{Ident: unique.Make(pkg.ID{0xff, 0}), Err: stub.UniqueError(0xbad00)},
|
||||
&pkg.CureError{Ident: unique.Make(pkg.ID{0xff, 1}), Err: stub.UniqueError(0xbad01)},
|
||||
&pkg.CureError{Ident: unique.Make(pkg.ID{0xff, 9}), Err: stub.UniqueError(0xbad09)},
|
||||
&pkg.CureError{Ident: unique.Make(pkg.ID{0xff, 0xf}), Err: stub.UniqueError(0xbad0f)},
|
||||
&pkg.CureError{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
||||
&pkg.CureError{A: makeIdent(0xff, 1), Err: stub.UniqueError(0xbad01)},
|
||||
&pkg.CureError{A: makeIdent(0xff, 9), Err: stub.UniqueError(0xbad09)},
|
||||
&pkg.CureError{A: makeIdent(0xff, 0xf), Err: stub.UniqueError(0xbad0f)},
|
||||
}},
|
||||
|
||||
{"dedup", pkg.DependencyCureError{
|
||||
{Ident: unique.Make(pkg.ID{0xff, 9}), Err: stub.UniqueError(0xbad09)},
|
||||
{Ident: unique.Make(pkg.ID{0xff, 0}), Err: stub.UniqueError(0xbad00)},
|
||||
{Ident: unique.Make(pkg.ID{0xff, 0xfd}), Err: &pkg.DependencyCureError{
|
||||
{Ident: unique.Make(pkg.ID{0xff, 9}), Err: stub.UniqueError(0xbad09)},
|
||||
{Ident: unique.Make(pkg.ID{0xff, 0xc}), Err: &pkg.DependencyCureError{
|
||||
{Ident: unique.Make(pkg.ID{0xff, 0xf}), Err: stub.UniqueError(0xbad0f)},
|
||||
{Ident: unique.Make(pkg.ID{0xff, 0}), Err: stub.UniqueError(0xbad00)},
|
||||
{A: makeIdent(0xff, 9), Err: stub.UniqueError(0xbad09)},
|
||||
{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
||||
{A: makeIdent(0xff, 0xfd), Err: &pkg.DependencyCureError{
|
||||
{A: makeIdent(0xff, 9), Err: stub.UniqueError(0xbad09)},
|
||||
{A: makeIdent(0xff, 0xc), Err: &pkg.DependencyCureError{
|
||||
{A: makeIdent(0xff, 0xf), Err: stub.UniqueError(0xbad0f)},
|
||||
{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
||||
}},
|
||||
{Ident: unique.Make(pkg.ID{0xff, 0}), Err: stub.UniqueError(0xbad00)},
|
||||
{Ident: unique.Make(pkg.ID{0xff, 0}), Err: stub.UniqueError(0xbad00)},
|
||||
{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
||||
{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
||||
}},
|
||||
{Ident: unique.Make(pkg.ID{0xff, 0xff}), Err: &pkg.DependencyCureError{
|
||||
{Ident: unique.Make(pkg.ID{0xff, 9}), Err: stub.UniqueError(0xbad09)},
|
||||
{Ident: unique.Make(pkg.ID{0xff, 0xc}), Err: &pkg.DependencyCureError{
|
||||
{Ident: unique.Make(pkg.ID{0xff, 0}), Err: stub.UniqueError(0xbad00)},
|
||||
{A: makeIdent(0xff, 0xff), Err: &pkg.DependencyCureError{
|
||||
{A: makeIdent(0xff, 9), Err: stub.UniqueError(0xbad09)},
|
||||
{A: makeIdent(0xff, 0xc), Err: &pkg.DependencyCureError{
|
||||
{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
||||
}},
|
||||
{Ident: unique.Make(pkg.ID{0xff, 0}), Err: stub.UniqueError(0xbad00)},
|
||||
{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
||||
}},
|
||||
{Ident: unique.Make(pkg.ID{0xff, 0xf}), Err: stub.UniqueError(0xbad0f)},
|
||||
{Ident: unique.Make(pkg.ID{0xff, 1}), Err: stub.UniqueError(0xbad01)},
|
||||
{A: makeIdent(0xff, 0xf), Err: stub.UniqueError(0xbad0f)},
|
||||
{A: makeIdent(0xff, 1), Err: stub.UniqueError(0xbad01)},
|
||||
}, `errors curing dependencies:
|
||||
_wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765184 injected by the test suite
|
||||
_wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765185 injected by the test suite
|
||||
_wkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765193 injected by the test suite
|
||||
_w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765199 injected by the test suite`, []error{
|
||||
&pkg.CureError{Ident: unique.Make(pkg.ID{0xff, 0}), Err: stub.UniqueError(0xbad00)},
|
||||
&pkg.CureError{Ident: unique.Make(pkg.ID{0xff, 1}), Err: stub.UniqueError(0xbad01)},
|
||||
&pkg.CureError{Ident: unique.Make(pkg.ID{0xff, 9}), Err: stub.UniqueError(0xbad09)},
|
||||
&pkg.CureError{Ident: unique.Make(pkg.ID{0xff, 0xf}), Err: stub.UniqueError(0xbad0f)},
|
||||
&pkg.CureError{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
||||
&pkg.CureError{A: makeIdent(0xff, 1), Err: stub.UniqueError(0xbad01)},
|
||||
&pkg.CureError{A: makeIdent(0xff, 9), Err: stub.UniqueError(0xbad09)},
|
||||
&pkg.CureError{A: makeIdent(0xff, 0xf), Err: stub.UniqueError(0xbad0f)},
|
||||
}},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user