[end2end] Reduce likelihood of two tests opening the same UDS socket (#33410)

pull/33413/head
Craig Tiller 2 years ago committed by GitHub
parent fa32eb36b3
commit 8e137e524a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      test/core/end2end/end2end_test_suites.cc

@ -21,6 +21,7 @@
#include <initializer_list> #include <initializer_list>
#include <map> #include <map>
#include <memory> #include <memory>
#include <random>
#include <regex> #include <regex>
#include <string> #include <string>
#include <utility> #include <utility>
@ -85,7 +86,7 @@ namespace grpc_core {
namespace { namespace {
std::atomic<int> unique{0}; std::atomic<uint64_t> unique{std::random_device()()};
void ProcessAuthFailure(void* state, grpc_auth_context* /*ctx*/, void ProcessAuthFailure(void* state, grpc_auth_context* /*ctx*/,
const grpc_metadata* /*md*/, size_t /*md_count*/, const grpc_metadata* /*md*/, size_t /*md_count*/,
@ -568,7 +569,7 @@ std::vector<CoreTestConfiguration> AllConfigs() {
return std::make_unique<LocalTestFixture>( return std::make_unique<LocalTestFixture>(
absl::StrFormat( absl::StrFormat(
"unix-abstract:grpc_fullstack_test.%%00.%d.%" PRId64 "unix-abstract:grpc_fullstack_test.%%00.%d.%" PRId64
".%" PRId32 ".%d", ".%" PRId32 ".%" PRId64,
getpid(), now.tv_sec, now.tv_nsec, getpid(), now.tv_sec, now.tv_nsec,
unique.fetch_add(1, std::memory_order_relaxed)), unique.fetch_add(1, std::memory_order_relaxed)),
UDS); UDS);
@ -611,7 +612,7 @@ std::vector<CoreTestConfiguration> AllConfigs() {
return std::make_unique<LocalTestFixture>( return std::make_unique<LocalTestFixture>(
absl::StrFormat( absl::StrFormat(
"unix:/tmp/grpc_fullstack_test.%%25.%d.%" PRId64 "unix:/tmp/grpc_fullstack_test.%%25.%d.%" PRId64
".%" PRId32 ".%d", ".%" PRId32 ".%" PRId64,
getpid(), now.tv_sec, now.tv_nsec, getpid(), now.tv_sec, now.tv_nsec,
unique.fetch_add(1, std::memory_order_relaxed)), unique.fetch_add(1, std::memory_order_relaxed)),
UDS); UDS);
@ -628,7 +629,7 @@ std::vector<CoreTestConfiguration> AllConfigs() {
return std::make_unique<LocalTestFixture>( return std::make_unique<LocalTestFixture>(
absl::StrFormat( absl::StrFormat(
"unix:/tmp/grpc_fullstack_test.%d.%" PRId64 ".%" PRId32 "unix:/tmp/grpc_fullstack_test.%d.%" PRId64 ".%" PRId32
".%d", ".%" PRId64,
getpid(), now.tv_sec, now.tv_nsec, getpid(), now.tv_sec, now.tv_nsec,
unique.fetch_add(1, std::memory_order_relaxed)), unique.fetch_add(1, std::memory_order_relaxed)),
UDS); UDS);
@ -846,7 +847,7 @@ std::vector<CoreTestConfiguration> AllConfigs() {
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME); gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
return std::make_unique<InsecureFixture>(absl::StrFormat( return std::make_unique<InsecureFixture>(absl::StrFormat(
"unix-abstract:grpc_fullstack_test.%d.%" PRId64 ".%" PRId32 "unix-abstract:grpc_fullstack_test.%d.%" PRId64 ".%" PRId32
".%d", ".%" PRId64,
getpid(), now.tv_sec, now.tv_nsec, getpid(), now.tv_sec, now.tv_nsec,
unique.fetch_add(1, std::memory_order_relaxed))); unique.fetch_add(1, std::memory_order_relaxed)));
}}, }},
@ -860,7 +861,8 @@ std::vector<CoreTestConfiguration> AllConfigs() {
[](const ChannelArgs&, const ChannelArgs&) { [](const ChannelArgs&, const ChannelArgs&) {
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME); gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
return std::make_unique<InsecureFixture>(absl::StrFormat( return std::make_unique<InsecureFixture>(absl::StrFormat(
"unix:/tmp/grpc_fullstack_test.%d.%" PRId64 ".%" PRId32 ".%d", "unix:/tmp/grpc_fullstack_test.%d.%" PRId64 ".%" PRId32
".%" PRId64,
getpid(), now.tv_sec, now.tv_nsec, getpid(), now.tv_sec, now.tv_nsec,
unique.fetch_add(1, std::memory_order_relaxed))); unique.fetch_add(1, std::memory_order_relaxed)));
}}, }},

Loading…
Cancel
Save