catalogue: Resolve keeps the digest of a templated module's archive as TemplatesDigest (A-481, A-481a)
Builds: design 47 G A-481, A-481a
This commit is contained in:
@@ -120,3 +120,19 @@ func TestAResourceNamingAPackageIsRefused(t *testing.T) {
|
||||
t.Fatal("a resource backed by a package was accepted; a package is not a resource")
|
||||
}
|
||||
}
|
||||
|
||||
// A templated module's resolved manifest keeps the digest of the archive its files were rendered from, handed or not
|
||||
// (design 47 G A-481, A-481a); a module with no templates keeps none.
|
||||
func TestResolveKeepsTheDigestOfTheTemplatesArchive(t *testing.T) {
|
||||
m := Manifest{Module: "tidy", Build: &Build{Artifacts: []Artifact{{Name: "files", Kind: ArtifactArchive, From: "files"}}}, Resources: []map[string]any{
|
||||
{"id": "tidy:conf", "type": "file", "path": "/etc/tidy.conf", TemplateField: "files/tidy.conf"}}}
|
||||
digest := "sha256:" + strings.Repeat("c", 64)
|
||||
got, err := m.Resolve([]Built{{Name: "files", Kind: ArtifactArchive, Digest: digest,
|
||||
Reference: ArtifactStoreScheme + "tidy/files/blobs/" + digest, Texts: map[string]string{"tidy.conf": "x"}}})
|
||||
if err != nil || got.TemplatesDigest != digest {
|
||||
t.Fatalf("templates digest %q, %v; want %s", got.TemplatesDigest, err, digest)
|
||||
}
|
||||
if plain, err := buildable().Resolve(wasBuilt()); err != nil || plain.TemplatesDigest != "" {
|
||||
t.Fatalf("a module with no templates keeps no templates digest: %q, %v", plain.TemplatesDigest, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user