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); }