File tree 1 file changed +11
-0
lines changed
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -914,6 +914,11 @@ static void test_resp3_push_handler(redisContext *c) {
914
914
old = redisSetPushCallback (c , push_handler );
915
915
test ("We can set a custom RESP3 PUSH handler: " );
916
916
reply = redisCommand (c , "SET key:0 val:0" );
917
+ /* We need another command because depending on the version of Redis, the
918
+ * notification may be delivered after the command's reply. */
919
+ test_cond (reply != NULL );
920
+ freeReplyObject (reply );
921
+ reply = redisCommand (c , "PING" );
917
922
test_cond (reply != NULL && reply -> type == REDIS_REPLY_STATUS && pc .str == 1 );
918
923
freeReplyObject (reply );
919
924
@@ -929,6 +934,12 @@ static void test_resp3_push_handler(redisContext *c) {
929
934
assert ((reply = redisCommand (c , "GET key:0" )) != NULL );
930
935
freeReplyObject (reply );
931
936
assert ((reply = redisCommand (c , "SET key:0 invalid" )) != NULL );
937
+ /* Depending on Redis version, we may receive either push notification or
938
+ * status reply. Both cases are valid. */
939
+ if (reply -> type == REDIS_REPLY_STATUS ) {
940
+ freeReplyObject (reply );
941
+ reply = redisCommand (c , "PING" );
942
+ }
932
943
test_cond (reply -> type == REDIS_REPLY_PUSH );
933
944
freeReplyObject (reply );
934
945
You can’t perform that action at this time.
0 commit comments