From eeeca01f374891cd31ca069723f9a1c4d0515030 Mon Sep 17 00:00:00 2001 From: Petr Sumbera Date: Fri, 22 May 2026 13:24:01 +0200 Subject: [PATCH] Fix memcapable delete test with permissive servers memcapable expected "delete a b c d e" to fail as a malformed ASCII delete command. Current memcached versions parse the extra tokens as accepted delete options and return NOT_FOUND for key "a" instead. Accept either the strict parser error or NOT_FOUND for this probe so memcapable stays compatible with both older strict servers and current memcached behavior without version-gating the test. --- src/bin/memcapable.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/bin/memcapable.cc b/src/bin/memcapable.cc index 122c294e..f9da3931 100644 --- a/src/bin/memcapable.cc +++ b/src/bin/memcapable.cc @@ -1078,6 +1078,14 @@ static enum test_return receive_error_response(void) { return TEST_PASS; } +static enum test_return receive_delete_with_extra_args_response(void) { + char buffer[80]; + execute(receive_line(buffer, sizeof(buffer))); + verify(strncmp(buffer, "ERROR", 5) == 0 || strncmp(buffer, "CLIENT_ERROR", 12) == 0 + || strcmp(buffer, "NOT_FOUND\r\n") == 0); + return TEST_PASS; +} + static enum test_return test_ascii_quit(void) { if (!v16x_or_greater) { /* Verify that quit handles unknown options */ @@ -1451,9 +1459,13 @@ static enum test_return test_ascii_delete_impl(const char *key, bool noreply) { execute(send_string("delete\r\n")); execute(receive_error_response()); - /* BUG: the server accepts delete a b */ + + /* + * Some servers reject extra delete arguments, while memcached 1.6 treats + * them as accepted option tokens and returns the result for key "a". + */ execute(send_string("delete a b c d e\r\n")); - execute(receive_error_response()); + execute(receive_delete_with_extra_args_response()); char buffer[1024]; snprintf(buffer, sizeof(buffer), "delete %s%s\r\n", key, noreply ? " noreply" : "");