Skip to content

Commit

Permalink
Update test of pubsub-replies without a channel/pattern string
Browse files Browse the repository at this point in the history
Perform the punsubscribe before entering non-pubsub mode since Valkey 8
dont allow several UNSUBSCRIBE commands executed under non-pubsub mode.
See valkey-io/valkey#759

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
  • Loading branch information
bjosv committed Sep 23, 2024
1 parent 4c4f858 commit d061dc7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/client_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1886,14 +1886,14 @@ void subscribe_channel_a_cb(valkeyAsyncContext *ac, void *r, void *privdata) {
strcmp(reply->element[2]->str, "Hello!") == 0);
state->checkpoint++;

/* Unsubscribe to channels, including channel X & Z which we don't subscribe to */
valkeyAsyncCommand(ac, unexpected_cb,
(void *)"unsubscribe should not call unexpected_cb()",
"unsubscribe B X A A Z");
/* Unsubscribe to patterns, none which we subscribe to */
valkeyAsyncCommand(ac, unexpected_cb,
(void *)"punsubscribe should not call unexpected_cb()",
"punsubscribe");
/* Unsubscribe to channels, including channel X & Z which we don't subscribe to */
valkeyAsyncCommand(ac, unexpected_cb,
(void *)"unsubscribe should not call unexpected_cb()",
"unsubscribe B X A A Z");
/* Send a regular command after unsubscribing, then disconnect */
state->disconnect = 1;
valkeyAsyncCommand(ac, integer_cb, state, "LPUSH mylist foo");
Expand Down

0 comments on commit d061dc7

Please sign in to comment.