diff --git a/src/server/dragonfly_test.cc b/src/server/dragonfly_test.cc index 9b7b84c69907..58041f26bc30 100644 --- a/src/server/dragonfly_test.cc +++ b/src/server/dragonfly_test.cc @@ -140,7 +140,6 @@ TEST_F(DflyEngineTest, Multi) { ASSERT_THAT(resp.GetVec(), ElementsAre(ArgType(RespExpr::NIL), ArgType(RespExpr::NIL))); atomic_bool tx_empty = true; - shard_set->RunBriefInParallel([&](EngineShard* shard) { if (!shard->txq()->Empty()) tx_empty.store(false); @@ -264,6 +263,7 @@ TEST_F(DflyEngineTest, MultiConsistent) { mset_fb.Join(); fb.Join(); + ASSERT_FALSE(service_->IsLocked(0, kKey1)); ASSERT_FALSE(service_->IsLocked(0, kKey4)); ASSERT_FALSE(service_->IsShardSetLocked()); @@ -865,6 +865,7 @@ TEST_F(DflyEngineTest, Bug468) { resp = Run({"exec"}); ASSERT_THAT(resp, ErrArg("not an integer")); + ASSERT_FALSE(service_->IsLocked(0, "foo")); resp = Run({"eval", "return redis.call('set', 'foo', 'bar', 'EX', 'moo')", "1", "foo"}); diff --git a/src/server/test_utils.cc b/src/server/test_utils.cc index 20d1a538606a..59b36856b1f7 100644 --- a/src/server/test_utils.cc +++ b/src/server/test_utils.cc @@ -207,6 +207,11 @@ RespExpr BaseFamilyTest::Run(std::string_view id, ArgSlice slice) { DCHECK(context->transaction == nullptr); + auto cmd = absl::AsciiStrToUpper(slice.front()); + if (cmd == "EVAL" || cmd == "EVALSHA" || cmd == "EXEC") { + shard_set->AwaitRunningOnShardQueue([](auto*) {}); // Wait for async UnlockMulti. + } + unique_lock lk(mu_); last_cmd_dbg_info_ = context->last_command_debug;