mirror of https://github.com/grpc/grpc.git
[testing] Adjust port selection algorithm on RBE (#33429)
I've got a hypothesis that we're losing isolation between test shards right now for "some reason". This is a change to reflect test sharding in the port distribution that we use, in an attempt to alleviate that. --------- Co-authored-by: ctiller <ctiller@users.noreply.github.com>pull/33273/head
parent
f34a39af74
commit
969c228934
9 changed files with 277 additions and 14 deletions
@ -0,0 +1,35 @@ |
||||
// Copyright 2023 gRPC authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "gtest/gtest.h" |
||||
|
||||
#include "test/core/util/test_config.h" |
||||
|
||||
namespace grpc { |
||||
namespace test { |
||||
|
||||
TEST(TestConfigTest, CurrentGtestShardIsNonZero) { |
||||
const int shard = testing::CurrentGtestShard(); |
||||
EXPECT_NE(shard, 0); |
||||
EXPECT_LE(shard, 50); |
||||
} |
||||
|
||||
} // namespace test
|
||||
} // namespace grpc
|
||||
|
||||
int main(int argc, char** argv) { |
||||
grpc::testing::TestEnvironment env(&argc, argv); |
||||
::testing::InitGoogleTest(&argc, argv); |
||||
return RUN_ALL_TESTS(); |
||||
} |
@ -0,0 +1,34 @@ |
||||
// Copyright 2023 gRPC authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "gtest/gtest.h" |
||||
|
||||
#include "test/core/util/test_config.h" |
||||
|
||||
namespace grpc { |
||||
namespace test { |
||||
|
||||
TEST(TestConfigTest, CurrentGtestShardZero) { |
||||
const int shard = testing::CurrentGtestShard(); |
||||
EXPECT_EQ(shard, 0); |
||||
} |
||||
|
||||
} // namespace test
|
||||
} // namespace grpc
|
||||
|
||||
int main(int argc, char** argv) { |
||||
grpc::testing::TestEnvironment env(&argc, argv); |
||||
::testing::InitGoogleTest(&argc, argv); |
||||
return RUN_ALL_TESTS(); |
||||
} |
Loading…
Reference in new issue