-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Remove call to proto.Clone() in http2Server.WriteStatus. #2842
Merged
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
36ed5dd
Add full support for configuring exponential connection backoff params.
easwars dffc6d6
Add full support for configuring exponential connection backoff params.
easwars a92e19d
Merge branch 'master' of github.com:easwars/grpc-go
easwars e51c0c3
Merge pull request #1 from grpc/master
easwars 65e8212
Handle review comments.
easwars 44d0c79
Handle vet failure.
easwars 8ffe677
Rollback changes made as part of #2735.
easwars 1c29ad5
Missed this in the previous commit.
easwars f5d99a4
Merge pull request #2 from grpc/master
easwars 57e1ed6
Unexpected diff from upstream.
easwars 8b06ff0
Merge remote-tracking branch 'upstream/master'
easwars 3e49ea2
Merge remote-tracking branch 'upstream/master'
easwars 57b05be
Remove call to proto.Clone() in http2Server.WriteStatus.
easwars e2bdc77
Review comments.
easwars a775841
Do not use gogo/proto for proto.Clone()
easwars File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* | ||
* Copyright 2019 gRPC authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package testutils | ||
|
||
import ( | ||
"github.com/gogo/protobuf/proto" | ||
"google.golang.org/grpc/status" | ||
) | ||
|
||
// StatusErrEqual returns true iff both err1 and err2 wrap status.Status errors | ||
// and their underlying status protos are equal. | ||
func StatusErrEqual(err1, err2 error) bool { | ||
status1, ok := status.FromError(err1) | ||
if !ok { | ||
return false | ||
} | ||
status2, ok := status.FromError(err2) | ||
if !ok { | ||
return false | ||
} | ||
return proto.Equal(status1.Proto(), status2.Proto()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* | ||
* Copyright 2019 gRPC authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package testutils | ||
|
||
import ( | ||
"testing" | ||
|
||
anypb "github.com/golang/protobuf/ptypes/any" | ||
spb "google.golang.org/genproto/googleapis/rpc/status" | ||
"google.golang.org/grpc/codes" | ||
"google.golang.org/grpc/status" | ||
) | ||
|
||
var statusErr = status.ErrorProto(&spb.Status{ | ||
Code: int32(codes.DataLoss), | ||
Message: "error for testing", | ||
Details: []*anypb.Any{{ | ||
TypeUrl: "url", | ||
Value: []byte{6, 0, 0, 6, 1, 3}, | ||
}}, | ||
}) | ||
|
||
func TestStatusErrEqual(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
err1 error | ||
err2 error | ||
wantEqual bool | ||
}{ | ||
{"nil errors", nil, nil, true}, | ||
{"equal OK status", status.New(codes.OK, "").Err(), status.New(codes.OK, "").Err(), true}, | ||
{"equal status errors", statusErr, statusErr, true}, | ||
{"different status errors", statusErr, status.New(codes.OK, "").Err(), false}, | ||
} | ||
|
||
for _, test := range tests { | ||
if gotEqual := StatusErrEqual(test.err1, test.err2); gotEqual != test.wantEqual { | ||
t.Errorf("%v: StatusErrEqual(%v, %v) = %v, want %v", test.name, test.err1, test.err2, gotEqual, test.wantEqual) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not use gogo/proto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thanks.
Some of the tests are unusually flaky today. Unable to make travis happy as of now.