avoid UDS conflict between tests in local bazel test run

pull/25258/head
Jan Tattermusch 4 years ago
parent 0c1676d9dc
commit c8e4a68edc
  1. 7
      test/core/end2end/fixtures/h2_local_uds.cc
  2. 9
      test/core/end2end/fixtures/h2_uds.cc

@ -16,6 +16,7 @@
*
*/
#include <inttypes.h>
#include <unistd.h>
#include "absl/strings/str_format.h"
@ -32,9 +33,11 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_uds(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f =
grpc_end2end_local_chttp2_create_fixture_fullstack();
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
static_cast<grpc_end2end_local_fullstack_fixture_data*>(f.fixture_data)
->localaddr = absl::StrFormat("unix:/tmp/grpc_fullstack_test.%d.%d",
getpid(), unique++);
->localaddr = absl::StrFormat(
"unix:/tmp/grpc_fullstack_test.%d.%" PRId64 ".%" PRId32 ".%d", getpid(),
now.tv_sec, now.tv_nsec, unique++);
return f;
}

@ -18,6 +18,7 @@
#include "test/core/end2end/end2end_tests.h"
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@ -62,16 +63,20 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_base(
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
const std::string localaddr = absl::StrFormat(
"unix:/tmp/grpc_fullstack_test.%d.%d", getpid(), unique++);
"unix:/tmp/grpc_fullstack_test.%d.%" PRId64 ".%" PRId32 ".%d", getpid(),
now.tv_sec, now.tv_nsec, unique++);
return chttp2_create_fixture_fullstack_base(localaddr);
}
static grpc_end2end_test_fixture
chttp2_create_fixture_fullstack_abstract_namespace(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
const std::string localaddr = absl::StrFormat(
"unix-abstract:grpc_fullstack_test.%d.%d", getpid(), unique++);
"unix-abstract:grpc_fullstack_test.%d.%" PRId64 ".%" PRId32 ".%d",
getpid(), now.tv_sec, now.tv_nsec, unique++);
return chttp2_create_fixture_fullstack_base(localaddr);
}

Loading…
Cancel
Save