From e2aa626714472c3d931ecde39abbb102c3622bf4 Mon Sep 17 00:00:00 2001 From: sewenew Date: Sat, 9 Mar 2024 20:00:59 +0800 Subject: [PATCH] fix async test for mset command --- test/src/sw/redis++/async_test.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/test/src/sw/redis++/async_test.h b/test/src/sw/redis++/async_test.h index 0a2f302..2932a9f 100644 --- a/test/src/sw/redis++/async_test.h +++ b/test/src/sw/redis++/async_test.h @@ -86,7 +86,10 @@ template void AsyncTest::_test_str() { auto key = test_key("str"); - KeyDeleter deleter(_redis, key); + auto key1 = test_key("key1"); + auto key2 = test_key("key2"); + + KeyDeleter deleter(_redis, {key, key1, key2}); std::string val("value"); REDIS_ASSERT(_redis.set(key, val, std::chrono::hours(1)).get(), @@ -137,6 +140,14 @@ void AsyncTest::_test_str() { this->set_ready(); }); _wait(); + + set_ready(false); + std::unordered_map kvs = {{key1, "val1"}, {key2, "val2"}}; + _redis.mset(kvs.begin(), kvs.end(), [this](Future &&fut) { + fut.get(); + this->set_ready(); + }); + _wait(); } template @@ -199,13 +210,6 @@ void AsyncTest::_test_hash() { this->set_ready(); }); _wait(); - - set_ready(false); - std::map mkeys = {{test_key("str")+"1", "val1"}, {test_key("str")+"2", "val2"}}; - _redis.mset(mkeys.begin(), mkeys.end(), [this](Future &&fut) { - this->set_ready(); - }); - _wait(); } template