feat(tvix/store/protos): add Deriver field to PathInfo

This uses the newly introduced StorePath message type to add a Deriver
field to the PathInfo message.

Support for validation is added to both the golang and rust
implementation. This includes extending unit tests.

Change-Id: Ifc3eb3263fa25b9eec260db354cd74234c40af7e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9647
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2023-10-11 00:22:40 +02:00 committed by flokli
parent 5f8eb4eeaa
commit 2d2c4322d9
10 changed files with 161 additions and 39 deletions

View file

@ -120,4 +120,30 @@ func TestValidate(t *testing.T) {
_, err := pi.Validate()
assert.Error(t, err, "must not validate")
})
t.Run("happy deriver", func(t *testing.T) {
pi := genPathInfoSymlink()
// add the Deriver Field.
pi.Deriver = &storev1pb.StorePath{
Digest: exampleStorePathDigest,
Name: "foo",
}
_, err := pi.Validate()
assert.NoError(t, err, "must validate")
})
t.Run("invalid deriver", func(t *testing.T) {
pi := genPathInfoSymlink()
// add the Deriver Field, with a broken digest
pi.Deriver = &storev1pb.StorePath{
Digest: []byte{},
Name: "foo2",
}
_, err := pi.Validate()
assert.Error(t, err, "must not validate")
})
}