diff options
author | Florian Klink <flokli@flokli.de> | 2023-10-10T22·22+0200 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2023-10-14T13·23+0000 |
commit | 2d2c4322d93308ddffe1647466abd91025af6a68 (patch) | |
tree | 37ead8574df6eb98d76ca95636b50bf8fe1945cb /tvix/store/protos/pathinfo_test.go | |
parent | 5f8eb4eeaaad31aedc45efee3143e6b0bbc982a4 (diff) |
feat(tvix/store/protos): add Deriver field to PathInfo r/6805
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
Diffstat (limited to 'tvix/store/protos/pathinfo_test.go')
-rw-r--r-- | tvix/store/protos/pathinfo_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tvix/store/protos/pathinfo_test.go b/tvix/store/protos/pathinfo_test.go index 74af50e5691f..9a329f0010fc 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") + }) + } |