Skip to content

Commit

Permalink
fix async test for mset command
Browse files Browse the repository at this point in the history
  • Loading branch information
sewenew committed Mar 9, 2024
1 parent eb3b2a4 commit e2aa626
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions test/src/sw/redis++/async_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ template <typename RedisInstance>
void AsyncTest<RedisInstance>::_test_str() {
auto key = test_key("str");

KeyDeleter<RedisInstance> deleter(_redis, key);
auto key1 = test_key("key1");
auto key2 = test_key("key2");

KeyDeleter<RedisInstance> deleter(_redis, {key, key1, key2});

std::string val("value");
REDIS_ASSERT(_redis.set(key, val, std::chrono::hours(1)).get(),
Expand Down Expand Up @@ -137,6 +140,14 @@ void AsyncTest<RedisInstance>::_test_str() {
this->set_ready();
});
_wait();

set_ready(false);
std::unordered_map<std::string, std::string> kvs = {{key1, "val1"}, {key2, "val2"}};
_redis.mset(kvs.begin(), kvs.end(), [this](Future<void> &&fut) {
fut.get();
this->set_ready();
});
_wait();
}

template <typename RedisInstance>
Expand Down Expand Up @@ -199,13 +210,6 @@ void AsyncTest<RedisInstance>::_test_hash() {
this->set_ready();
});
_wait();

set_ready(false);
std::map<std::string, std::string> mkeys = {{test_key("str")+"1", "val1"}, {test_key("str")+"2", "val2"}};
_redis.mset(mkeys.begin(), mkeys.end(), [this](Future<void> &&fut) {
this->set_ready();
});
_wait();
}

template <typename RedisInstance>
Expand Down

0 comments on commit e2aa626

Please sign in to comment.