summaryrefslogtreecommitdiff
path: root/infra
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-09-25 18:51:09 +0800
committeryangwei <[email protected]>2024-09-25 18:51:09 +0800
commitfac67648f7c9dac127ccdcda918e5aa4beade36c (patch)
tree00cdb6297a0d941d366993f8798cddaf8c02c9df /infra
parent75d60bb3eaaf626b6e143fb989a972042e225a1a (diff)
🧪 test(mq publish at once): add test case
Diffstat (limited to 'infra')
-rw-r--r--infra/mq/test/gtest_mq_main.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/infra/mq/test/gtest_mq_main.cpp b/infra/mq/test/gtest_mq_main.cpp
index 3cca4cc..2f16fcb 100644
--- a/infra/mq/test/gtest_mq_main.cpp
+++ b/infra/mq/test/gtest_mq_main.cpp
@@ -339,9 +339,10 @@ static void test_pub_on_msg_free(void *msg, void *msg_free_arg)
{
struct test_pub_on_free_env *env = (struct test_pub_on_free_env *)msg_free_arg;
env->on_msg_free_called+=1;
- if(env->current_round==env->N_round-1 && (long)msg!=env->N_round)
+ if((long)msg!=env->N_round && (int)(long)msg==env->N_round-1)
{
EXPECT_EQ(mq_runtime_publish_message(env->rt, env->topic_id, (void *)(long)(env->N_round)), -1);//on message free, publish always failed
+ EXPECT_EQ(mq_runtime_publish_message_at_once(env->rt, env->topic_id, (void *)(long)(env->N_round)), 0);//on message free, publish at once success
}
return;
}
@@ -379,8 +380,8 @@ TEST(mq_runtime, pub_on_msg_free)
mq_runtime_free(env.rt);
mq_schema_free(env.s);
- EXPECT_EQ(env.on_msg_free_called, env.N_round);
- EXPECT_EQ(env.on_msg_called, env.N_round);
+ EXPECT_EQ(env.on_msg_free_called, env.N_round+1);
+ EXPECT_EQ(env.on_msg_called, env.N_round+1);
}