Skip to content

Commit

Permalink
Merge branch 'update/changelogUpdate' of https://github.com/deanurag/…
Browse files Browse the repository at this point in the history
…etcd into update/changelogUpdate
  • Loading branch information
deanurag committed Dec 6, 2024
2 parents 6f306ac + 4d26370 commit 11256ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
7 changes: 3 additions & 4 deletions api/etcdserverpb/raft_internal_stringer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ package etcdserverpb_test
import (
"testing"

"github.com/stretchr/testify/assert"

pb "go.etcd.io/etcd/api/v3/etcdserverpb"
)

// TestInvalidGoTypeIntPanic tests conditions that caused
// panic: invalid Go type int for field k8s_io.kubernetes.vendor.go_etcd_io.etcd.etcdserver.etcdserverpb.loggablePutRequest.value_size
// See https://github.com/kubernetes/kubernetes/issues/91937 for more details
func TestInvalidGoTypeIntPanic(t *testing.T) {
result := pb.NewLoggablePutRequest(&pb.PutRequest{}).String()
if result != "" {
t.Errorf("Got result: %s, expected empty string", result)
}
assert.Empty(t, pb.NewLoggablePutRequest(&pb.PutRequest{}).String())
}
17 changes: 7 additions & 10 deletions api/v3rpc/rpctypes/error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"errors"
"testing"

"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
Expand All @@ -28,17 +29,13 @@ func TestConvert(t *testing.T) {
var e3 EtcdError
errors.As(ErrEmptyKey, &e3)

if e1.Error() != e2.Error() {
t.Fatalf("expected %q == %q", e1.Error(), e2.Error())
}
if ev1, ok := status.FromError(e1); ok && ev1.Code() != e3.Code() {
t.Fatalf("expected them to be equal, got %v / %v", ev1.Code(), e3.Code())
require.Equal(t, e1.Error(), e2.Error())
if ev1, ok := status.FromError(e1); ok {
require.Equal(t, ev1.Code(), e3.Code())
}

if e1.Error() == e3.Error() {
t.Fatalf("expected %q != %q", e1.Error(), e3.Error())
}
if ev2, ok := status.FromError(e2); ok && ev2.Code() != e3.Code() {
t.Fatalf("expected them to be equal, got %v / %v", ev2.Code(), e3.Code())
require.NotEqual(t, e1.Error(), e3.Error())
if ev2, ok := status.FromError(e2); ok {
require.Equal(t, ev2.Code(), e3.Code())
}
}

0 comments on commit 11256ed

Please sign in to comment.