Skip to content

Commit a032552

Browse files
alyssawilkfredlas
authored andcommitted
test: fix a test crash by deleting test time later (envoyproxy#5145)
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 <[email protected]> Signed-off-by: Fred Douglas <[email protected]>
1 parent 3b4ec83 commit a032552

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

test/common/grpc/grpc_client_integration.h

+6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ class GrpcClientIntegrationParamTest
4242
public testing::TestWithParam<std::tuple<Network::Address::IpVersion, ClientType>> {
4343
public:
4444
~GrpcClientIntegrationParamTest() {}
45+
static std::string protocolTestParamsToString(
46+
const testing::TestParamInfo<std::tuple<Network::Address::IpVersion, ClientType>>& p) {
47+
return absl::StrCat(
48+
(std::get<0>(p.param) == Network::Address::IpVersion::v4 ? "IPv4_" : "IPv6_"),
49+
(std::get<1>(p.param) == ClientType::GoogleGrpc ? "GoogleGrpc" : "EnvoyGrpc"));
50+
}
4551
Network::Address::IpVersion ipVersion() const override { return std::get<0>(GetParam()); }
4652
ClientType clientType() const override { return std::get<1>(GetParam()); }
4753
};

test/common/grpc/grpc_client_integration_test.cc

+6-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ namespace {
1313

1414
// Parameterize the loopback test server socket address and gRPC client type.
1515
INSTANTIATE_TEST_CASE_P(IpVersionsClientType, GrpcClientIntegrationTest,
16-
GRPC_CLIENT_INTEGRATION_PARAMS);
16+
GRPC_CLIENT_INTEGRATION_PARAMS,
17+
GrpcClientIntegrationParamTest::protocolTestParamsToString);
1718

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

329330
// Parameterize the loopback test server socket address and gRPC client type.
330331
INSTANTIATE_TEST_CASE_P(SslIpVersionsClientType, GrpcSslClientIntegrationTest,
331-
GRPC_CLIENT_INTEGRATION_PARAMS);
332+
GRPC_CLIENT_INTEGRATION_PARAMS,
333+
GrpcClientIntegrationParamTest::protocolTestParamsToString);
332334

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

391393
// Parameterize the loopback test server socket address and gRPC client type.
392394
INSTANTIATE_TEST_CASE_P(SslIpVersionsClientType, GrpcAccessTokenClientIntegrationTest,
393-
GRPC_CLIENT_INTEGRATION_PARAMS);
395+
GRPC_CLIENT_INTEGRATION_PARAMS,
396+
GrpcClientIntegrationParamTest::protocolTestParamsToString);
394397

395398
// Validate that a simple request-reply unary RPC works with AccessToken auth.
396399
TEST_P(GrpcAccessTokenClientIntegrationTest, AccessTokenAuthRequest) {

test/common/grpc/grpc_client_integration_test_harness.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,11 @@ class GrpcClientIntegrationTest : public GrpcClientIntegrationParamTest {
396396
return stream;
397397
}
398398

399+
DangerousDeprecatedTestTime test_time_;
399400
std::unique_ptr<FakeUpstream> fake_upstream_;
400401
FakeHttpConnectionPtr fake_connection_;
401402
std::vector<FakeStreamPtr> fake_streams_;
402403
const Protobuf::MethodDescriptor* method_descriptor_;
403-
DangerousDeprecatedTestTime test_time_;
404404
Event::DispatcherImpl dispatcher_;
405405
DispatcherHelper dispatcher_helper_{dispatcher_};
406406
Stats::IsolatedStoreImpl* stats_store_ = new Stats::IsolatedStoreImpl();

0 commit comments

Comments
 (0)