Skip to content

Commit

Permalink
disable stress test (eBay#178)
Browse files Browse the repository at this point in the history
Co-authored-by: Ravi Akella email = [email protected] <raakella@sdsbuild07>
  • Loading branch information
raakella1 and Ravi Akella email = [email protected] authored Sep 11, 2023
1 parent a424845 commit cbc315f
Showing 1 changed file with 0 additions and 50 deletions.
50 changes: 0 additions & 50 deletions src/auth_manager/tests/LRUCacheTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,56 +64,6 @@ TEST(LRUTest, get) {
EXPECT_EQ(value, lru.get(key));
}

TEST(LRUTest, stress_test) {
struct val {
std::string s;
};
auto p_get = std::make_shared< std::promise< void > >();
auto f_get = p_get->get_future();
auto p_put = std::make_shared< std::promise< void > >();
auto f_put = p_put->get_future();
static constexpr size_t iter = 3000;
auto lru = LRUCache< int, val >(2000);
auto putter = [&lru, p_put](int const i) {
lru.put(i, val{std::to_string(i)});
if (i == iter) { p_put->set_value(); }
};
auto getter = [&lru, p_get](int const i) {
if (lru.exists(i)) {
auto v = lru.get(i);
EXPECT_EQ(v->s, std::to_string(i));
}
if (i == iter) { p_get->set_value(); }
};
for (size_t i = 1; i <= iter; i++) {
std::thread(putter, i).detach();
}
f_put.get();

for (size_t i = 1; i <= iter; i++) {
std::thread(getter, i).detach();
}

f_get.get();
auto p_get1 = std::make_shared< std::promise< void > >();
auto f_get1 = p_get1->get_future();
static constexpr int single_key = 10000;
lru.put(single_key, val{std::to_string(single_key)});
for (size_t i = 1; i <= 5000; i++) {
std::thread(
[&lru, p_get1](int const i) {
if (lru.exists(single_key)) {
auto v = lru.get(single_key);
EXPECT_EQ(v->s, std::to_string(single_key));
}
if (i == 5000) { p_get1->set_value(); }
},
i)
.detach();
}
f_get1.get();
}

} // namespace sisl::testing

int main(int argc, char* argv[]) {
Expand Down

0 comments on commit cbc315f

Please sign in to comment.