From 2d2c4322d93308ddffe1647466abd91025af6a68 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Wed, 11 Oct 2023 00:22:40 +0200 Subject: 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 Tested-by: BuildkiteCI --- tvix/store/protos/pathinfo_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tvix/store/protos/pathinfo_test.go') diff --git a/tvix/store/protos/pathinfo_test.go b/tvix/store/protos/pathinfo_test.go index 74af50e569..9a329f0010 100644 --- a/tvix/store/protos/pathinfo_test.go +++ b/tvix/store/protos/pathinfo_test.go @@ -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") + }) + } -- cgit 1.4.1