diff options
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") + }) + } |