-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add grpc c++ client conformance tests (#512)
The minimal footprint to get a grpc-based binary that can run the conformance tests. To test run: - run a test server, for example `go run cmd/serverconnect/main.go --insecure --h1port=8080 --h2port=8081` - run the conformance tests `PORT=8081 bazel run //cc:grpc_client_test` Will require follow up PRs to fully integrate into crosstest docker images and CI. Also note that the grpc client does not properly convert 404's into UNIMPLEMENTED, instead returning UNKNOWN.
- Loading branch information
Showing
21 changed files
with
21,741 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 | ||
build --cxxopt=-fsized-deallocation | ||
|
||
# Enable matchers in googletest | ||
build --define absl=1 | ||
|
||
build:asan --linkopt -ldl | ||
build:asan --linkopt -fsanitize=address | ||
build:asan --copt -fsanitize=address | ||
build:asan --copt -DADDRESS_SANITIZER=1 | ||
build:asan --copt -D__SANITIZE_ADDRESS__ | ||
build:asan --test_env=ASAN_OPTIONS=handle_abort=1:allow_addr2line=true:check_initialization_order=true:strict_init_order=true:detect_odr_violation=1 | ||
build:asan --test_env=ASAN_SYMBOLIZER_PATH | ||
build:asan --copt -O1 | ||
build:asan --copt -fno-optimize-sibling-calls | ||
build:asan --linkopt=-fuse-ld=lld | ||
|
||
build:macos --features=-supports_dynamic_linker | ||
|
||
build:clang --action_env=CC=clang --host_action_env=CC=clang | ||
build:clang --action_env=CXX=clang++ --host_action_env=CXX=clang++ | ||
|
||
try-import %workspace%/clang.bazelrc | ||
try-import %workspace%/user.bazelrc | ||
try-import %workspace%/local_tsan.bazelrc |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/.tmp/ | ||
/bazel-* | ||
*.pprof | ||
*.svg | ||
cover.out | ||
|
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,19 @@ | ||
workspace(name = "com_github_bufbuild_protovalidate") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "com_github_grpc_grpc", | ||
strip_prefix = "grpc-1.56.2", | ||
urls = [ | ||
"https://github.com/grpc/grpc/archive/v1.56.2.tar.gz", | ||
], | ||
) | ||
|
||
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") | ||
|
||
grpc_deps() | ||
|
||
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps") | ||
|
||
grpc_extra_deps() |
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,115 @@ | ||
--- | ||
AccessModifierOffset: -1 | ||
AlignAfterOpenBracket: AlwaysBreak | ||
AlignConsecutiveMacros: false | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveBitFields: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlines: Left | ||
AlignOperands: DontAlign | ||
AlignTrailingComments: false | ||
AllowAllArgumentsOnNextLine: true | ||
AllowAllConstructorInitializersOnNextLine: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortEnumsOnASingleLine: true | ||
AllowShortBlocksOnASingleLine: Never | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Inline | ||
AllowShortLambdasOnASingleLine: All | ||
AllowShortIfStatementsOnASingleLine: AllIfsAndElse | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: true | ||
AlwaysBreakTemplateDeclarations: Yes | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeBraces: Attach | ||
BreakInheritanceList: BeforeColon | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializers: BeforeColon | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakStringLiterals: false | ||
ColumnLimit: 100 | ||
CommentPragmas: '^ IWYU pragma:' | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DeriveLineEnding: true | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
FixNamespaceComments: true | ||
ForEachMacros: | ||
- FOR_EACH | ||
- FOR_EACH_R | ||
- FOR_EACH_RANGE | ||
IncludeBlocks: Regroup | ||
IncludeCategories: | ||
- Regex: '^<(sodium|Python)\.h>$' | ||
Priority: 3 | ||
- Regex: '^<((arpa|net|netinet|sys|linux)\/)?[-_[:alnum:]]+\.h>$' | ||
Priority: 1 | ||
- Regex: '^<[\/-_[:alnum:]]+>$' | ||
Priority: 2 | ||
- Regex: '^<.*>$' | ||
Priority: 4 | ||
- Regex: '.*' | ||
Priority: 5 | ||
IncludeIsMainRegex: '((Test|Tests|_test|Bench|Benchmark|Performance)[0-9]*)?$' | ||
IndentCaseLabels: true | ||
IndentCaseBlocks: false | ||
IndentGotoLabels: true | ||
IndentPPDirectives: None | ||
IndentExternBlock: AfterExternBlock | ||
IndentWidth: 2 | ||
IndentWrappedFunctionNames: false | ||
InsertTrailingCommas: None | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBinPackProtocolList: Auto | ||
ObjCBlockIndentWidth: 2 | ||
ObjCBreakBeforeNestedBlockParam: true | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: false | ||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 1 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyBreakTemplateDeclaration: 10 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 200 | ||
PointerAlignment: Left | ||
ReflowComments: true | ||
SortIncludes: true | ||
SortUsingDeclarations: true | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterLogicalNot: false | ||
SpaceAfterTemplateKeyword: true | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceInEmptyBlock: false | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: false | ||
SpacesInConditionalStatement: false | ||
SpacesInContainerLiterals: true | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
SpaceBeforeSquareBrackets: false | ||
Standard: Latest | ||
TabWidth: 8 | ||
UseCRLF: false | ||
UseTab: Never |
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,56 @@ | ||
Checks: '-clang-analyzer-core.NonNullParamChecker, | ||
-clang-analyzer-optin.cplusplus.UninitializedObject, | ||
abseil-*, | ||
bugprone-* | ||
clang-analyzer-core.DivideZero, | ||
misc-unused-using-decls, | ||
modernize-*, | ||
-modernize-use-trailing-return-type, | ||
performance-*, | ||
readability-*, | ||
-readability-identifier-length, | ||
-readability-else-after-return' | ||
|
||
CheckOptions: | ||
- key: bugprone-assert-side-effect.AssertMacros | ||
value: 'ASSERT' | ||
|
||
- key: bugprone-dangling-handle.HandleClasses | ||
value: 'std::basic_string_view;std::experimental::basic_string_view;absl::string_view' | ||
|
||
- key: modernize-use-auto.MinTypeNameLength | ||
value: '10' | ||
|
||
- key: readability-identifier-naming.ClassCase | ||
value: 'CamelCase' | ||
|
||
- key: readability-identifier-naming.EnumCase | ||
value: 'CamelCase' | ||
|
||
- key: readability-identifier-naming.EnumConstantCase | ||
value: 'CamelCase' | ||
|
||
# Ignore GoogleTest function macros. | ||
- key: readability-identifier-naming.FunctionIgnoredRegexp | ||
value: '(TEST|TEST_F|TEST_P|INSTANTIATE_TEST_SUITE_P|MOCK_METHOD|TYPED_TEST)' | ||
|
||
- key: readability-identifier-naming.ParameterCase | ||
value: 'camelBack' | ||
|
||
- key: readability-identifier-naming.PrivateMemberCase | ||
value: 'camelBack' | ||
|
||
- key: readability-identifier-naming.PrivateMemberSuffix | ||
value: '_' | ||
|
||
- key: readability-identifier-naming.StructCase | ||
value: 'aNy_CasE' | ||
|
||
- key: readability-identifier-naming.TypeAliasCase | ||
value: 'aNy_CasE' | ||
|
||
- key: readability-identifier-naming.UnionCase | ||
value: 'CamelCase' | ||
|
||
- key: readability-identifier-naming.FunctionCase | ||
value: 'aNy_CasE' |
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 2022 Buf Technologies, Inc. | ||
# | ||
# 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(default_visibility = ["//cc:__subpackages__"]) | ||
|
||
cc_test( | ||
name = "grpc_client_test", | ||
srcs = ["grpc_client_test.cc"], | ||
env = {"PORT": "8081"}, | ||
deps = [ | ||
"//cc:gen-connectrpc-conformance", | ||
"@com_github_grpc_grpc//:grpc++", | ||
"@com_google_googleapis//google/rpc:status_cc_proto", | ||
"@com_google_googletest//:gtest_main", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "gen-connectrpc-conformance", | ||
srcs = glob(["gen/connectrpc/conformance/*.cc"]), | ||
hdrs = glob(["gen/connectrpc/conformance/*.h"]), | ||
includes = ["gen"], | ||
deps = [ | ||
"@com_github_grpc_grpc//:grpc++", | ||
"@com_google_protobuf//:protobuf", | ||
], | ||
) |
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,41 @@ | ||
// Copyright 2022 Buf Technologies, Inc. | ||
// | ||
// 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. | ||
|
||
// Generated by the gRPC C++ plugin. | ||
// If you make any local change, they will be lost. | ||
// source: connectrpc/conformance/messages.proto | ||
|
||
#include "connectrpc/conformance/messages.pb.h" | ||
#include "connectrpc/conformance/messages.grpc.pb.h" | ||
|
||
#include <functional> | ||
#include <grpcpp/support/async_stream.h> | ||
#include <grpcpp/support/async_unary_call.h> | ||
#include <grpcpp/impl/channel_interface.h> | ||
#include <grpcpp/impl/client_unary_call.h> | ||
#include <grpcpp/support/client_callback.h> | ||
#include <grpcpp/support/message_allocator.h> | ||
#include <grpcpp/support/method_handler.h> | ||
#include <grpcpp/impl/rpc_service_method.h> | ||
#include <grpcpp/support/server_callback.h> | ||
#include <grpcpp/impl/server_callback_handlers.h> | ||
#include <grpcpp/server_context.h> | ||
#include <grpcpp/impl/service_type.h> | ||
#include <grpcpp/support/sync_stream.h> | ||
namespace connectrpc { | ||
namespace conformance { | ||
|
||
} // namespace connectrpc | ||
} // namespace conformance | ||
|
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,46 @@ | ||
// Copyright 2022 Buf Technologies, Inc. | ||
// | ||
// 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. | ||
|
||
#ifndef GRPC_connectrpc_2fconformance_2fmessages_2eproto__INCLUDED | ||
#define GRPC_connectrpc_2fconformance_2fmessages_2eproto__INCLUDED | ||
|
||
#include "connectrpc/conformance/messages.pb.h" | ||
|
||
#include <functional> | ||
#include <grpcpp/generic/async_generic_service.h> | ||
#include <grpcpp/support/async_stream.h> | ||
#include <grpcpp/support/async_unary_call.h> | ||
#include <grpcpp/support/client_callback.h> | ||
#include <grpcpp/client_context.h> | ||
#include <grpcpp/completion_queue.h> | ||
#include <grpcpp/support/message_allocator.h> | ||
#include <grpcpp/support/method_handler.h> | ||
#include <grpcpp/impl/proto_utils.h> | ||
#include <grpcpp/impl/rpc_method.h> | ||
#include <grpcpp/support/server_callback.h> | ||
#include <grpcpp/impl/server_callback_handlers.h> | ||
#include <grpcpp/server_context.h> | ||
#include <grpcpp/impl/service_type.h> | ||
#include <grpcpp/support/status.h> | ||
#include <grpcpp/support/stub_options.h> | ||
#include <grpcpp/support/sync_stream.h> | ||
|
||
namespace connectrpc { | ||
namespace conformance { | ||
|
||
} // namespace conformance | ||
} // namespace connectrpc | ||
|
||
|
||
#endif // GRPC_connectrpc_2fconformance_2fmessages_2eproto__INCLUDED |
Oops, something went wrong.