Skip to content

Commit

Permalink
test: fix a test crash by deleting test time later (envoyproxy#5145)
Browse files Browse the repository at this point in the history
also pretty printing grpc test params while I'm in there because I dislike figuring out what test is failing via staring at Test/0 Test/1 Test/2 Test/3

Risk Level: Low (test only)
Testing: goes from 80% failure with flake-options on to 0% failure
Docs Changes: n/a
Release Notes: n/a
Fixes envoyproxy#5071

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Fred Douglas <fredlas@google.com>
  • Loading branch information
alyssawilk authored and fredlas committed Mar 5, 2019
1 parent 3b4ec83 commit a032552
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 6 additions & 0 deletions test/common/grpc/grpc_client_integration.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ class GrpcClientIntegrationParamTest
public testing::TestWithParam<std::tuple<Network::Address::IpVersion, ClientType>> {
public:
~GrpcClientIntegrationParamTest() {}
static std::string protocolTestParamsToString(
const testing::TestParamInfo<std::tuple<Network::Address::IpVersion, ClientType>>& p) {
return absl::StrCat(
(std::get<0>(p.param) == Network::Address::IpVersion::v4 ? "IPv4_" : "IPv6_"),
(std::get<1>(p.param) == ClientType::GoogleGrpc ? "GoogleGrpc" : "EnvoyGrpc"));
}
Network::Address::IpVersion ipVersion() const override { return std::get<0>(GetParam()); }
ClientType clientType() const override { return std::get<1>(GetParam()); }
};
Expand Down
9 changes: 6 additions & 3 deletions test/common/grpc/grpc_client_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ namespace {

// Parameterize the loopback test server socket address and gRPC client type.
INSTANTIATE_TEST_CASE_P(IpVersionsClientType, GrpcClientIntegrationTest,
GRPC_CLIENT_INTEGRATION_PARAMS);
GRPC_CLIENT_INTEGRATION_PARAMS,
GrpcClientIntegrationParamTest::protocolTestParamsToString);

// Validate that a simple request-reply stream works.
TEST_P(GrpcClientIntegrationTest, BasicStream) {
Expand Down Expand Up @@ -328,7 +329,8 @@ TEST_P(GrpcClientIntegrationTest, CancelRequest) {

// Parameterize the loopback test server socket address and gRPC client type.
INSTANTIATE_TEST_CASE_P(SslIpVersionsClientType, GrpcSslClientIntegrationTest,
GRPC_CLIENT_INTEGRATION_PARAMS);
GRPC_CLIENT_INTEGRATION_PARAMS,
GrpcClientIntegrationParamTest::protocolTestParamsToString);

// Validate that a simple request-reply unary RPC works with SSL.
TEST_P(GrpcSslClientIntegrationTest, BasicSslRequest) {
Expand Down Expand Up @@ -390,7 +392,8 @@ class GrpcAccessTokenClientIntegrationTest : public GrpcSslClientIntegrationTest

// Parameterize the loopback test server socket address and gRPC client type.
INSTANTIATE_TEST_CASE_P(SslIpVersionsClientType, GrpcAccessTokenClientIntegrationTest,
GRPC_CLIENT_INTEGRATION_PARAMS);
GRPC_CLIENT_INTEGRATION_PARAMS,
GrpcClientIntegrationParamTest::protocolTestParamsToString);

// Validate that a simple request-reply unary RPC works with AccessToken auth.
TEST_P(GrpcAccessTokenClientIntegrationTest, AccessTokenAuthRequest) {
Expand Down
2 changes: 1 addition & 1 deletion test/common/grpc/grpc_client_integration_test_harness.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,11 @@ class GrpcClientIntegrationTest : public GrpcClientIntegrationParamTest {
return stream;
}

DangerousDeprecatedTestTime test_time_;
std::unique_ptr<FakeUpstream> fake_upstream_;
FakeHttpConnectionPtr fake_connection_;
std::vector<FakeStreamPtr> fake_streams_;
const Protobuf::MethodDescriptor* method_descriptor_;
DangerousDeprecatedTestTime test_time_;
Event::DispatcherImpl dispatcher_;
DispatcherHelper dispatcher_helper_{dispatcher_};
Stats::IsolatedStoreImpl* stats_store_ = new Stats::IsolatedStoreImpl();
Expand Down

0 comments on commit a032552

Please sign in to comment.