Skip to content

Commit

Permalink
test(storage): reduce iterations in integration test (#7564)
Browse files Browse the repository at this point in the history
Works around a broken build on Kokoro + macOS + Bazel.
  • Loading branch information
coryan authored Nov 5, 2021
1 parent 6f47d5b commit 656932b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions google/cloud/storage/tests/thread_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,12 @@ TEST_F(ThreadIntegrationTest, Unshared) {
ASSERT_STATUS_OK(meta);
EXPECT_EQ(bucket_name, meta->name());

auto constexpr kObjectCount = 2000;
std::vector<std::string> objects(kObjectCount);
auto const thread_count = (std::max)(std::thread::hardware_concurrency(), 8U);
auto const object_count = 100 * thread_count;
std::vector<std::string> objects(object_count);
std::generate(objects.begin(), objects.end(),
[this] { return MakeRandomObjectName(); });

auto thread_count = std::thread::hardware_concurrency();
if (thread_count == 0) thread_count = 4;

auto const groups = DivideIntoEqualSizedGroups(objects, thread_count);
std::vector<std::future<void>> tasks(groups.size());
std::transform(groups.begin(), groups.end(), tasks.begin(),
Expand All @@ -134,7 +132,7 @@ TEST_F(ThreadIntegrationTest, Unshared) {
if (!o.ok()) break;
++found;
}
EXPECT_GE(found, kObjectCount / 2);
EXPECT_GE(found, object_count / 2);
std::transform(groups.begin(), groups.end(), tasks.begin(),
[&](ObjectNameList const& g) {
return std::async(std::launch::async,
Expand Down

0 comments on commit 656932b

Please sign in to comment.