internal/pkg: check exec substitution
All checks were successful
Test / Create distribution (push) Successful in 1m16s
Test / Sandbox (push) Successful in 3m0s
Test / Hakurei (push) Successful in 4m15s
Test / ShareFS (push) Successful in 4m9s
Test / Sandbox (race detector) (push) Successful in 5m45s
Test / Hakurei (race detector) (push) Successful in 6m47s
Test / Flake checks (push) Successful in 1m23s
All checks were successful
Test / Create distribution (push) Successful in 1m16s
Test / Sandbox (push) Successful in 3m0s
Test / Hakurei (push) Successful in 4m15s
Test / ShareFS (push) Successful in 4m9s
Test / Sandbox (race detector) (push) Successful in 5m45s
Test / Hakurei (race detector) (push) Successful in 6m47s
Test / Flake checks (push) Successful in 1m23s
This relies on the testtool having ident as relevant input to assert successful substitution. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -246,26 +246,37 @@ func newDestroyArtifactFunc(a pkg.Artifact) func(
|
||||
}
|
||||
|
||||
// destroyStatus counts non-substitution status entries and destroys them.
|
||||
func destroyStatus(t *testing.T, base *check.Absolute, n int) {
|
||||
func destroyStatus(t *testing.T, base *check.Absolute, c, s int) {
|
||||
dents, err := os.ReadDir(base.Append("status").String())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
var gotC, gotS int
|
||||
for _, dent := range dents {
|
||||
if !dent.Type().IsRegular() {
|
||||
t.Errorf("%s: %s", dent.Name(), dent.Type())
|
||||
}
|
||||
if err = os.Remove(base.Append(
|
||||
"status",
|
||||
dent.Name(),
|
||||
).String()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if dent.Type().IsRegular() {
|
||||
gotC++
|
||||
continue
|
||||
}
|
||||
if dent.Type()&fs.ModeSymlink == fs.ModeSymlink {
|
||||
gotS++
|
||||
continue
|
||||
}
|
||||
t.Errorf("%s: %s", dent.Name(), dent.Type())
|
||||
}
|
||||
|
||||
if len(dents) != n {
|
||||
t.Errorf("ReadDir: %d entries, want %d", len(dents), n)
|
||||
if gotC != c {
|
||||
t.Errorf("status: c = %d, want %d", gotC, c)
|
||||
}
|
||||
if gotS != s {
|
||||
t.Errorf("status: s = %d, want %d", gotS, s)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user