From 91ceec295df19d0af42c8c52f4af26d6509e181c Mon Sep 17 00:00:00 2001 From: Hengfeng Li Date: Sat, 11 Jul 2020 02:06:00 +1000 Subject: [PATCH] spanner: fix the upgrade of protobuf. (#2583) Fixes: #2582 --- spanner/cmp_test.go | 3 +++ spanner/transaction_test.go | 22 +--------------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/spanner/cmp_test.go b/spanner/cmp_test.go index 3cb039b28744..76a0fb3d8ead 100644 --- a/spanner/cmp_test.go +++ b/spanner/cmp_test.go @@ -51,6 +51,9 @@ func testEqual(a, b interface{}) bool { if strings.Contains(path.GoString(), "{*status.Error}.unknownFields") { return true } + if strings.Contains(path.GoString(), "{*status.Error}.e") { + return true + } return false }, cmp.Ignore())) } diff --git a/spanner/transaction_test.go b/spanner/transaction_test.go index 46ffd052101c..07cdc24d541b 100644 --- a/spanner/transaction_test.go +++ b/spanner/transaction_test.go @@ -28,7 +28,6 @@ import ( . "cloud.google.com/go/spanner/internal/testutil" "github.com/golang/protobuf/ptypes" - "github.com/google/go-cmp/cmp" "google.golang.org/api/iterator" "google.golang.org/genproto/googleapis/rpc/errdetails" sppb "google.golang.org/genproto/googleapis/spanner/v1" @@ -245,26 +244,7 @@ func TestTransaction_SessionNotFound(t *testing.T) { Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(2), "Bar", int64(1)}), } _, got := client.Apply(ctx, ms, ApplyAtLeastOnce()) - if !cmp.Equal(wantErr, got, - cmp.AllowUnexported(Error{}), cmp.FilterPath(func(path cmp.Path) bool { - // Ignore Error Details and Error.trailers. - if strings.Contains(path.GoString(), "{*spanner.Error}.err.(*status.Error).Details") { - return true - } - if strings.Contains(path.GoString(), "{*spanner.Error}.trailers") { - return true - } - if strings.Contains(path.GoString(), "{*spanner.Error}.err.(*status.Error).state") { - return true - } - if strings.Contains(path.GoString(), "{*spanner.Error}.err.(*status.Error).sizeCache") { - return true - } - if strings.Contains(path.GoString(), "{*spanner.Error}.err.(*status.Error).unknownFields") { - return true - } - return false - }, cmp.Ignore())) { + if !testEqual(wantErr, got) { t.Fatalf("Expect Apply to fail\nGot: %v\nWant: %v\n", got, wantErr) } }