@@ -26,15 +26,28 @@ func validBuildLock(t *testing.T) BuildLockV1 {
2626 if err != nil {
2727 t .Fatal (err )
2828 }
29+ upstream := providers.RealizedImageV1 {Digest : base .ConfigDigest , ConfigDigest : base .ConfigDigest , RootFSSubject : baseRootFS }
30+ verifier := ApplicationStartupVerifierContractV1 ()
31+ verifier .Artifact = buildLockTestDigest ("6" )
32+ verifier .Size = "123"
33+ transaction , err := ApplicationRuntimeLayerTransactionDigestV1 (verifier , upstream , platform )
34+ if err != nil {
35+ t .Fatal (err )
36+ }
37+ result := providers.RealizedImageV1 {Digest : buildLockTestDigest ("5" ), ConfigDigest : buildLockTestDigest ("5" ), RootFSSubject : buildLockTestDigest ("7" )}
2938 return BuildLockV1 {
3039 Schema : BuildLockSchemaV1 , BlueprintDigest : buildLockTestDigest ("0" ), Overlay : EmptyRequestOverlayV1 (),
3140 PackageOverrides : EmptyPackageOverrideIntentV1 ("demo" ),
3241 ResolvedRequestDigest : buildLockTestDigest ("1" ), Platform : platform ,
3342 Base : base ,
3443 Graph : ProviderGraphLockV1 {Nodes : []providers.NodeID {"base" }, Edges : []providers.ProviderEdgeV1 {}},
3544 Nodes : []NodeLockV1 {}, Catalog : []providers.RealizedOutput {}, RuntimePolicy : validRuntimePolicy (),
45+ RuntimeLayer : ApplicationRuntimeLayerV1 {
46+ Schema : ApplicationRuntimeLayerSchemaV1 , Verifier : verifier , TransactionDigest : transaction ,
47+ Upstream : upstream , Result : result ,
48+ },
3649 ValidationRecord : providerstore.StoreObjectRef {Kind : providerstore .ValidationRecordKind , Digest : buildLockTestDigest ("4" )},
37- FinalImage : providers. RealizedImageV1 { Digest : buildLockTestDigest ( "5" ), ConfigDigest : buildLockTestDigest ( "5" ), RootFSSubject : baseRootFS } ,
50+ FinalImage : result ,
3851 }
3952}
4053
@@ -84,7 +97,11 @@ func addValidAPTNode(t *testing.T, lock *BuildLockV1) {
8497 GeneratedExecutables : []providers.RealizedGeneratedExecutable {},
8598 Outputs : []providers.RealizedOutput {},
8699 }}
87- lock .FinalImage .RootFSSubject = result .RootFSSubject
100+ lock .RuntimeLayer .Upstream = result
101+ lock .RuntimeLayer .TransactionDigest , err = ApplicationRuntimeLayerTransactionDigestV1 (lock .RuntimeLayer .Verifier , result , lock .Platform )
102+ if err != nil {
103+ t .Fatal (err )
104+ }
88105}
89106
90107func TestBuildLockV1CanonicalRoundTripAndIdentity (t * testing.T ) {
@@ -160,7 +177,7 @@ func TestBuildLockV1RejectsDisconnectedImageLineage(t *testing.T) {
160177 t .Run ("final root filesystem" , func (t * testing.T ) {
161178 lock := validBuildLock (t )
162179 lock .FinalImage .RootFSSubject = buildLockTestDigest ("6" )
163- if _ , err := BuildLockDigestV1 (lock , acceptBuildLockProfile ); err == nil || ! strings .Contains (err .Error (), "does not match the final graph prefix " ) {
180+ if _ , err := BuildLockDigestV1 (lock , acceptBuildLockProfile ); err == nil || ! strings .Contains (err .Error (), "does not match the application runtime layer " ) {
164181 t .Fatalf ("lineage error = %v" , err )
165182 }
166183 })
@@ -179,6 +196,9 @@ func TestBuildLockV1RejectsInvalidNestedIdentity(t *testing.T) {
179196 {name : "missing node lock" , mutate : func (value * BuildLockV1 ) { value .Graph .Nodes = []providers.NodeID {"apt" , "base" } }, want : "missing node" },
180197 {name : "nil catalog" , mutate : func (value * BuildLockV1 ) { value .Catalog = nil }, want : "catalog" },
181198 {name : "runtime policy" , mutate : func (value * BuildLockV1 ) { value .RuntimePolicy .Schema = "bad" }, want : "runtime policy" },
199+ {name : "runtime verifier contract" , mutate : func (value * BuildLockV1 ) { value .RuntimeLayer .Verifier .Path = "/bin/true" }, want : "startup verifier" },
200+ {name : "runtime layer transaction" , mutate : func (value * BuildLockV1 ) { value .RuntimeLayer .TransactionDigest = buildLockTestDigest ("f" ) }, want : "transaction digest" },
201+ {name : "runtime layer upstream" , mutate : func (value * BuildLockV1 ) { value .RuntimeLayer .Upstream .ConfigDigest = buildLockTestDigest ("f" ) }, want : "final graph prefix" },
182202 {name : "validation kind" , mutate : func (value * BuildLockV1 ) { value .ValidationRecord .Kind = providerstore .BlobKind }, want : "validation-record" },
183203 {name : "final image" , mutate : func (value * BuildLockV1 ) { value .FinalImage .RootFSSubject = "bad" }, want : "final image" },
184204 }
0 commit comments