Index manifest input candidates within each operation
This commit is contained in:
@@ -240,3 +240,22 @@ func TestResolvePreparedGlossaryDocuments(t *testing.T) {
|
||||
t.Fatalf("retired source: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInputLookupKeepsSnapshotAndRechecksFileContent(t *testing.T) {
|
||||
paths, m, file, _ := preparedInputFixture(t, artifactpolicy.SourceInputParty, []byte("party: ready\n"))
|
||||
m.Inputs = append(m.Inputs, manifest.InputRecord{Kind: "unrelated", Path: "../../outside"})
|
||||
lookup := NewInputLookup(paths, m)
|
||||
m.Inputs = nil
|
||||
if _, err := ResolvePreparedInputWithLookup(paths, lookup, artifactpolicy.SourceInputParty); err != nil {
|
||||
t.Fatalf("snapshot resolution: %v", err)
|
||||
}
|
||||
if _, err := ResolvePreparedInputWithLookup(paths, NewInputLookup(paths, m), artifactpolicy.SourceInputParty); !errors.Is(err, ErrPreparedInputAbsent) {
|
||||
t.Fatalf("replaced inputs: %v", err)
|
||||
}
|
||||
if err := os.WriteFile(file, []byte("party: changed\n"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := ResolvePreparedInputWithLookup(paths, lookup, artifactpolicy.SourceInputParty); err == nil || !strings.Contains(err.Error(), "checksum mismatch") {
|
||||
t.Fatalf("changed content: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user