From c0efed12e3a5bcc27833b4c691914001bd7e2de7 Mon Sep 17 00:00:00 2001 From: Henna Huang Date: Fri, 5 May 2017 11:59:15 -0400 Subject: [PATCH] Parameterize echo listener address --- echo2_integration_test.cc | 20 ++++++++++++-------- echo2_server.json | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/echo2_integration_test.cc b/echo2_integration_test.cc index 0989c2e57..fbb4cbeab 100644 --- a/echo2_integration_test.cc +++ b/echo2_integration_test.cc @@ -1,27 +1,31 @@ #include "test/integration/integration.h" #include "test/integration/utility.h" -class Echo2IntegrationTest : public BaseIntegrationTest, public testing::Test { +class Echo2IntegrationTest : public BaseIntegrationTest, + public testing::TestWithParam { public: /** - * Global initializer for all integration tests. + * Initializer for an individual integration test. */ - static void SetUpTestCase() { - createTestServer("echo2_server.json", {"echo"}); + void SetUp() override { + createTestServer("echo2_server.json", GetParam(), {"echo"}); } /** - * Global destructor for all integration tests. + * Destructor for an individual integration test. */ - static void TearDownTestCase() { + void TearDown() override { test_server_.reset(); } }; -TEST_F(Echo2IntegrationTest, Echo) { +INSTANTIATE_TEST_CASE_P(IpVersions, Echo2IntegrationTest, + testing::ValuesIn(TestEnvironment::getIpVersionsForTest())); + +TEST_P(Echo2IntegrationTest, Echo) { Buffer::OwnedImpl buffer("hello"); std::string response; - RawConnectionDriver connection(lookupPort("echo"), buffer, + RawConnectionDriver connection(lookupPort("echo"), GetParam(), buffer, [&](Network::ClientConnection&, const Buffer::Instance& data) -> void { response.append(TestUtility::bufferToString(data)); diff --git a/echo2_server.json b/echo2_server.json index 2bda725d9..511fdf217 100644 --- a/echo2_server.json +++ b/echo2_server.json @@ -1,7 +1,7 @@ { "listeners": [ { - "address": "tcp://127.0.0.1:0", + "address": "tcp://{{ ip_loopback_address }}:0", "use_original_dst": true, "filters": [ { "type": "read", "name": "ratelimit",