From d50b3b1ce5a0ac18034ad43756fa0bf9b2305e72 Mon Sep 17 00:00:00 2001 From: Kazuyoshi Kato Date: Sat, 18 Nov 2023 12:34:08 -0800 Subject: [PATCH] fix tests --- solver/llbsolver/vertex_test.go | 2 +- sourcepolicy/mutate_test.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/solver/llbsolver/vertex_test.go b/solver/llbsolver/vertex_test.go index e41647f9dfd06..7b07b8964b342 100644 --- a/solver/llbsolver/vertex_test.go +++ b/solver/llbsolver/vertex_test.go @@ -51,6 +51,6 @@ func TestRecomputeDigests(t *testing.T) { require.Equal(t, newDigest, visited[oldDigest]) require.Equal(t, op1, all[newDigest]) assert.Equal(t, op2, all[updated]) - require.Equal(t, newDigest, op2.Inputs[0].Digest) + require.Equal(t, newDigest, digest.Digest(op2.Inputs[0].Digest)) assert.NotEqual(t, op2Digest, updated) } diff --git a/sourcepolicy/mutate_test.go b/sourcepolicy/mutate_test.go index a14b6d9ea8579..1351c77a290b1 100644 --- a/sourcepolicy/mutate_test.go +++ b/sourcepolicy/mutate_test.go @@ -7,6 +7,7 @@ import ( "github.com/moby/buildkit/solver/pb" spb "github.com/moby/buildkit/sourcepolicy/pb" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" ) func TestMutate(t *testing.T) { @@ -126,7 +127,7 @@ func TestMutate(t *testing.T) { ctx := context.Background() for _, tc := range testCases { - op := *tc.op + op := tc.op t.Run(op.String(), func(t *testing.T) { src := op.GetSource() mutated, err := mutate(ctx, src, tc.rule, &selectorCache{Selector: tc.rule.Selector}, src.GetIdentifier()) @@ -134,7 +135,7 @@ func TestMutate(t *testing.T) { if tc.expectedErr != "" { require.Error(t, err, tc.expectedErr) } else { - require.Equal(t, tc.expectedOp, &op) + require.True(t, proto.Equal(tc.expectedOp, op)) } }) }