Reduce run time of some tests.

This commit is contained in:
levlam 2022-07-28 00:15:18 +03:00
parent 6283dce8b7
commit 07b7faf66c
3 changed files with 7 additions and 7 deletions

View File

@ -253,7 +253,7 @@ class MainQueryActor final : public td::Actor {
} }
void wakeup() final { void wakeup() final {
int cnt = 100000; int cnt = 10000;
while (out_cnt_ < in_cnt_ + 100 && out_cnt_ < cnt) { while (out_cnt_ < in_cnt_ + 100 && out_cnt_ < cnt) {
if (td::Random::fast_bool()) { if (td::Random::fast_bool()) {
send_closure(rand_elem(actors_), &QueryActor::query, create_query()); send_closure(rand_elem(actors_), &QueryActor::query, create_query());
@ -294,7 +294,7 @@ class SimpleActor final : public td::Actor {
} }
void wakeup() final { void wakeup() final {
if (q_ == 100000) { if (q_ == 10000) {
td::Scheduler::instance()->finish(); td::Scheduler::instance()->finish();
stop(); stop();
return; return;

View File

@ -138,13 +138,13 @@ TEST(Actors, workers_big_query_nine_threads) {
} }
TEST(Actors, workers_small_query_one_thread) { TEST(Actors, workers_small_query_one_thread) {
test_workers(0, 10, 1000000, 1); test_workers(0, 10, 100000, 1);
} }
TEST(Actors, workers_small_query_two_threads) { TEST(Actors, workers_small_query_two_threads) {
test_workers(2, 10, 1000000, 1); test_workers(2, 10, 100000, 1);
} }
TEST(Actors, workers_small_query_nine_threads) { TEST(Actors, workers_small_query_nine_threads) {
test_workers(9, 10, 1000000, 1); test_workers(9, 10, 10000, 1);
} }

View File

@ -377,7 +377,7 @@ TEST(DB, key_value) {
values.push_back(td::rand_string('a', 'b', td::Random::fast(1, 10))); values.push_back(td::rand_string('a', 'b', td::Random::fast(1, 10)));
} }
int queries_n = 3000; int queries_n = 1000;
td::vector<DbQuery> queries(queries_n); td::vector<DbQuery> queries(queries_n);
for (auto &q : queries) { for (auto &q : queries) {
int op = td::Random::fast(0, 2); int op = td::Random::fast(0, 2);
@ -427,7 +427,7 @@ TEST(DB, key_value) {
ASSERT_EQ(a.value, c.value); ASSERT_EQ(a.value, c.value);
ASSERT_EQ(a.value, d.value); ASSERT_EQ(a.value, d.value);
ASSERT_EQ(a.value, e.value); ASSERT_EQ(a.value, e.value);
if (cnt++ % 500 == 0) { if (cnt++ % 200 == 0) {
new_kv.impl().init(new_kv_name.str()).ensure(); new_kv.impl().init(new_kv_name.str()).ensure();
} }
} }