Repository: mesos Updated Branches: refs/heads/master eb6986938 -> a925b77d5
Only run netcat tests when nc is available. Review: https://reviews.apache.org/r/36216 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/a925b77d Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a925b77d Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a925b77d Branch: refs/heads/master Commit: a925b77d53fabcc22e4b4988e18b40387e17b0ab Parents: eecf0d4 Author: Timothy Chen <[email protected]> Authored: Tue Jul 7 11:51:36 2015 -0700 Committer: Timothy Chen <[email protected]> Committed: Tue Jul 7 12:26:12 2015 -0700 ---------------------------------------------------------------------- src/tests/docker_containerizer_tests.cpp | 2 +- src/tests/environment.cpp | 26 ++++++++++++++++++++++++++ src/tests/port_mapping_tests.cpp | 12 ++++++------ 3 files changed, 33 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/a925b77d/src/tests/docker_containerizer_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/docker_containerizer_tests.cpp b/src/tests/docker_containerizer_tests.cpp index 0a87333..a3da786 100644 --- a/src/tests/docker_containerizer_tests.cpp +++ b/src/tests/docker_containerizer_tests.cpp @@ -2120,7 +2120,7 @@ TEST_F(DockerContainerizerTest, // exposing the host port to the container port, by sending data // to the host port and receiving it in the container by listening // to the mapped container port. -TEST_F(DockerContainerizerTest, ROOT_DOCKER_PortMapping) +TEST_F(DockerContainerizerTest, ROOT_DOCKER_NC_PortMapping) { Try<PID<Master> > master = StartMaster(); ASSERT_SOME(master); http://git-wip-us.apache.org/repos/asf/mesos/blob/a925b77d/src/tests/environment.cpp ---------------------------------------------------------------------- diff --git a/src/tests/environment.cpp b/src/tests/environment.cpp index 3726e5d..5253470 100644 --- a/src/tests/environment.cpp +++ b/src/tests/environment.cpp @@ -239,6 +239,31 @@ private: }; +class NetcatFilter : public TestFilter +{ +public: + NetcatFilter() + { + netcatError = os::system("which nc") != 0; + if (netcatError) { + std::cerr + << "-------------------------------------------------------------\n" + << "No 'nc' command found so no tests depending on 'nc' will run\n" + << "-------------------------------------------------------------" + << std::endl; + } + } + + bool disable(const ::testing::TestInfo* test) const + { + return matches(test, "NC_") && netcatError; + } + +private: + bool netcatError; +}; + + class BenchmarkFilter : public TestFilter { public: @@ -368,6 +393,7 @@ Environment::Environment(const Flags& _flags) : flags(_flags) filters.push_back(Owned<TestFilter>(new BenchmarkFilter())); filters.push_back(Owned<TestFilter>(new NetworkIsolatorTestFilter())); filters.push_back(Owned<TestFilter>(new PerfFilter())); + filters.push_back(Owned<TestFilter>(new NetcatFilter())); // Construct the filter string to handle system or platform specific tests. ::testing::UnitTest* unitTest = ::testing::UnitTest::GetInstance(); http://git-wip-us.apache.org/repos/asf/mesos/blob/a925b77d/src/tests/port_mapping_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/port_mapping_tests.cpp b/src/tests/port_mapping_tests.cpp index ac49cdf..f01c3e1 100644 --- a/src/tests/port_mapping_tests.cpp +++ b/src/tests/port_mapping_tests.cpp @@ -429,7 +429,7 @@ static bool waitForFileCreation( // 'validPort' and 'invalidPort'. Verify that only the connection // through 'validPort' is successful by confirming that the expected // data has been written to its output file. -TEST_F(PortMappingIsolatorTest, ROOT_ContainerToContainerTCP) +TEST_F(PortMappingIsolatorTest, ROOT_NC_ContainerToContainerTCP) { Try<Isolator*> isolator = PortMappingIsolatorProcess::create(flags); CHECK_SOME(isolator); @@ -589,7 +589,7 @@ TEST_F(PortMappingIsolatorTest, ROOT_ContainerToContainerTCP) // The same container-to-container test but with UDP. -TEST_F(PortMappingIsolatorTest, ROOT_ContainerToContainerUDP) +TEST_F(PortMappingIsolatorTest, ROOT_NC_ContainerToContainerUDP) { Try<Isolator*> isolator = PortMappingIsolatorProcess::create(flags); CHECK_SOME(isolator); @@ -751,7 +751,7 @@ TEST_F(PortMappingIsolatorTest, ROOT_ContainerToContainerUDP) // Test the scenario where a UDP server is in a container while host // tries to establish a UDP connection. -TEST_F(PortMappingIsolatorTest, ROOT_HostToContainerUDP) +TEST_F(PortMappingIsolatorTest, ROOT_NC_HostToContainerUDP) { Try<Isolator*> isolator = PortMappingIsolatorProcess::create(flags); CHECK_SOME(isolator); @@ -868,7 +868,7 @@ TEST_F(PortMappingIsolatorTest, ROOT_HostToContainerUDP) // Test the scenario where a TCP server is in a container while host // tries to establish a TCP connection. -TEST_F(PortMappingIsolatorTest, ROOT_HostToContainerTCP) +TEST_F(PortMappingIsolatorTest, ROOT_NC_HostToContainerTCP) { Try<Isolator*> isolator = PortMappingIsolatorProcess::create(flags); CHECK_SOME(isolator); @@ -1450,7 +1450,7 @@ TEST_F(PortMappingIsolatorTest, ROOT_TooManyContainers) // Test the scenario where PortMappingIsolator uses a very small // egress rate limit. -TEST_F(PortMappingIsolatorTest, ROOT_SmallEgressLimit) +TEST_F(PortMappingIsolatorTest, ROOT_NC_SmallEgressLimit) { // Note that the underlying rate limiting mechanism usually has a // small allowance for burst. Empirically, as least 10x of the rate @@ -1605,7 +1605,7 @@ bool HasTCPSocketsRTT(const ResourceStatistics& statistics) // Test that RTT can be returned properly from usage(). This test is // very similar to SmallEgressLimitTest in its setup. -TEST_F(PortMappingIsolatorTest, ROOT_PortMappingStatistics) +TEST_F(PortMappingIsolatorTest, ROOT_NC_PortMappingStatistics) { // To-be-tested egress rate limit, in Bytes/s. const Bytes rate = 2000;
