From fac67648f7c9dac127ccdcda918e5aa4beade36c Mon Sep 17 00:00:00 2001 From: yangwei Date: Wed, 25 Sep 2024 18:51:09 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20test(mq=20publish=20at=20once):?= =?UTF-8?q?=20add=20test=20case?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infra/mq/test/gtest_mq_main.cpp | 7 ++++--- 1 file 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); }