Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: fix test lint warnings #4632

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions examples/internal/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func TestEchoPatch(t *testing.T) {
return
}

sent := examplepb.DynamicMessage{
sent := &examplepb.DynamicMessage{
StructField: &structpb.Struct{Fields: map[string]*structpb.Value{
"struct_key": {Kind: &structpb.Value_StructValue{
StructValue: &structpb.Struct{Fields: map[string]*structpb.Value{
Expand All @@ -112,7 +112,7 @@ func TestEchoPatch(t *testing.T) {
}},
}},
}
payload, err := protojson.MarshalOptions{UseProtoNames: true}.Marshal(&sent)
payload, err := protojson.MarshalOptions{UseProtoNames: true}.Marshal(sent)
if err != nil {
t.Fatalf("marshaler.Marshal(%#v) failed with %v; want success", payload, err)
}
Expand Down Expand Up @@ -146,12 +146,12 @@ func TestEchoPatch(t *testing.T) {
return
}
if diff := cmp.Diff(received.Body, sent, protocmp.Transform()); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
if diff := cmp.Diff(received.UpdateMask, fieldmaskpb.FieldMask{Paths: []string{
"struct_field.struct_key.layered_struct_key", "value_field.value_struct_key",
}}, protocmp.Transform(), protocmp.SortRepeatedFields(received.UpdateMask, "paths")); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down Expand Up @@ -478,7 +478,7 @@ func testEchoBody(t *testing.T, port int, apiPrefix string, useTrailers bool) {
return
}
if diff := cmp.Diff(&received, &sent, protocmp.Transform()); diff != "" {
t.Errorf(diff)
t.Error(diff)
}

if got, want := resp.Header.Get("Grpc-Metadata-Foo"), "foo1"; got != want {
Expand Down Expand Up @@ -580,7 +580,7 @@ func testABECreate(t *testing.T, port int) {
}
msg.Uuid = ""
if diff := cmp.Diff(msg, want, protocmp.Transform()); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down Expand Up @@ -690,7 +690,7 @@ func testABECreateBody(t *testing.T, port int) {
}
msg.Uuid = ""
if diff := cmp.Diff(msg, want, protocmp.Transform()); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down Expand Up @@ -945,7 +945,7 @@ func testABELookup(t *testing.T, port int) {
return
}
if diff := cmp.Diff(msg, want, protocmp.Transform()); diff != "" {
t.Errorf(diff)
t.Error(diff)
}

if got, want := resp.Header.Get("Grpc-Metadata-Uuid"), want.Uuid; got != want {
Expand Down Expand Up @@ -1125,7 +1125,7 @@ func TestABEPatchBody(t *testing.T) {
want, got := tc.want, getABE(t, port, uuid)
got.Uuid = "" // empty out uuid so we don't need to worry about it in comparisons
if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
})
}
Expand Down Expand Up @@ -1412,7 +1412,7 @@ func testABEBulkEcho(t *testing.T, port int) {

wg.Wait()
if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down Expand Up @@ -1634,7 +1634,7 @@ func testABERepeated(t *testing.T, port int) {
return
}
if diff := cmp.Diff(msg, want, protocmp.Transform()); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down Expand Up @@ -1812,7 +1812,7 @@ func testResponseBody(t *testing.T, port int) {
}

if diff := cmp.Diff(string(buf), `{"data":"foo"}`); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
}

Expand All @@ -1834,7 +1834,7 @@ func TestResponseBodyStream(t *testing.T) {
}

if diff := cmp.Diff(body, []string{`{"result":{"data":"first foo"}}`, `{"result":{"data":"second foo"}}`}); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
}

Expand All @@ -1856,7 +1856,7 @@ func TestResponseBodyStreamHttpBody(t *testing.T) {
}

if diff := cmp.Diff(body, []string{"Hello 1", "Hello 2"}); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
}

Expand All @@ -1878,7 +1878,7 @@ func TestResponseBodyStreamHttpBodyError(t *testing.T) {
}

if diff := cmp.Diff(body, []string{"Hello 1", "Hello 2", `{"error":{"code":3,"message":"error","details":[]}}`}); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down Expand Up @@ -1930,7 +1930,7 @@ func testResponseBodies(t *testing.T, port int) {
},
}
if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down Expand Up @@ -1982,7 +1982,7 @@ func testResponseStrings(t *testing.T, port int) {
}
want := []string{"hello", "foo"}
if diff := cmp.Diff(got, want); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
})

Expand Down Expand Up @@ -2013,7 +2013,7 @@ func testResponseStrings(t *testing.T, port int) {
}
want := []string{}
if diff := cmp.Diff(got, want); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
})

Expand Down Expand Up @@ -2049,7 +2049,7 @@ func testResponseStrings(t *testing.T, port int) {
},
}
if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
})
}
Expand Down Expand Up @@ -2414,7 +2414,7 @@ func testNonStandardNames(t *testing.T, port int, method string, jsonBody string
t.Fatalf("marshaler.Unmarshal failed: %v", err)
}
if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/codegenerator/parse_req_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestParseRequest(t *testing.T) {
t.Error("did not error as expected")
}
if diff := cmp.Diff(out, tt.out, protocmp.Transform()); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
})
}
Expand Down
6 changes: 3 additions & 3 deletions protoc-gen-openapiv2/internal/genopenapi/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2062,7 +2062,7 @@ func TestApplyTemplateExtensions(t *testing.T) {
}
want := []string{"baz"}
if diff := cmp.Diff(got, want); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
}
{
Expand All @@ -2073,7 +2073,7 @@ func TestApplyTemplateExtensions(t *testing.T) {
}
want := "bar"
if diff := cmp.Diff(got, want); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down Expand Up @@ -10816,7 +10816,7 @@ func TestRenderServicesOptionDeprecated(t *testing.T) {
methodOptions: descriptorpb.MethodOptions{
Deprecated: proto.Bool(true),
},
openapiOperation: &openapi_options.Operation{},
openapiOperation: &openapi_options.Operation{},
expectedDeprecated: true,
},
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/marshal_json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func TestJSONBuiltinsnmarshal(t *testing.T) {
Id: "foo",
}
if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down
Loading