Skip to content

Commit

Permalink
test: allowing uds_integration_test to run with --runs_per_test=
Browse files Browse the repository at this point in the history
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
  • Loading branch information
alyssawilk committed Jul 3, 2018
1 parent b686053 commit c574b0e
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions test/integration/uds_integration_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
#include "gtest/gtest.h"

namespace Envoy {

std::string udsSocketName(const std::string& path, bool abstract_namespace) {
const std::string name = TestEnvironment::unixDomainSocketPath(path);
if (!abstract_namespace) {
return name;
}
return "@" + name;
}

class UdsUpstreamIntegrationTest
: public HttpIntegrationTest,
public testing::TestWithParam<std::tuple<Network::Address::IpVersion, bool>> {
Expand All @@ -23,8 +32,8 @@ class UdsUpstreamIntegrationTest
abstract_namespace_(std::get<1>(GetParam())) {}

void createUpstreams() override {
fake_upstreams_.emplace_back(
new FakeUpstream(getSocketName(), FakeHttpConnection::Type::HTTP1));
fake_upstreams_.emplace_back(new FakeUpstream(
udsSocketName("udstest.1.sock", abstract_namespace_), FakeHttpConnection::Type::HTTP1));

config_helper_.addConfigModifier(
[&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void {
Expand All @@ -33,17 +42,13 @@ class UdsUpstreamIntegrationTest
auto* cluster = static_resources->mutable_clusters(i);
for (int j = 0; j < cluster->hosts_size(); ++j) {
cluster->mutable_hosts(j)->clear_socket_address();
cluster->mutable_hosts(j)->mutable_pipe()->set_path(getSocketName());
cluster->mutable_hosts(j)->mutable_pipe()->set_path(
udsSocketName("udstest.1.sock", abstract_namespace_));
}
}
});
}

std::string getSocketName() {
return abstract_namespace_ ? "@/my/udstest"
: TestEnvironment::unixDomainSocketPath("udstest.1.sock");
}

protected:
const bool abstract_namespace_;
};
Expand All @@ -58,17 +63,11 @@ class UdsListenerIntegrationTest

void initialize() override;

std::string getSocketName(const std::string& path) {
const std::string name = TestEnvironment::unixDomainSocketPath(path);
if (!abstract_namespace_) {
return name;
}
return "@" + name;
}

std::string getAdminSocketName() { return getSocketName("admin.sock"); }
std::string getAdminSocketName() { return udsSocketName("admin.sock", abstract_namespace_); }

std::string getListenerSocketName() { return getSocketName("listener_0.sock"); }
std::string getListenerSocketName() {
return udsSocketName("listener_0.sock", abstract_namespace_);
}

protected:
HttpIntegrationTest::ConnectionCreationFunction createConnectionFn();
Expand Down

0 comments on commit c574b0e

Please sign in to comment.