pgbackrest.git / summary / log / commit / refs

commit    8d0cce66f83abc1ff02a985ec3f0d7e285c09d72
Author:   David Steele <david@pgmasters.net>
Date:     Sun Feb 13 21:19:31 2022 +0000

    Use normal error for protocol module error retry test.
    
    Asserts will not be retried in a future commit, so adjust this test now to use non-assert errors.


doc/xml/release.xml | 1 + test/src/module/protocol/protocolTest.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/xml/release.xml b/doc/xml/release.xml index fd85dd7d4..b1d969566 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -127,6 +127,7 @@ <release-item> <commit subject="Improve protocol module error test for protocolClientFree()."/> + <commit subject="Use normal error for protocol module error retry test."/> <release-item-contributor-list> <release-item-contributor id="david.steele"/> diff --git a/test/src/module/protocol/protocolTest.c b/test/src/module/protocol/protocolTest.c index 220abe053..2e946029e 100644 --- a/test/src/module/protocol/protocolTest.c +++ b/test/src/module/protocol/protocolTest.c @@ -21,8 +21,6 @@ Test protocol server command handlers ***********************************************************************************************************************************/ #define TEST_PROTOCOL_COMMAND_ASSERT STRID5("assert", 0x2922ce610) -static unsigned int testCommandAssertProtocolTotal = 0; - __attribute__((__noreturn__)) static void testCommandAssertProtocol(PackRead *const param, ProtocolServer *const server) { @@ -34,14 +32,15 @@ testCommandAssertProtocol(PackRead *const param, ProtocolServer *const server) ASSERT(param == NULL); ASSERT(server != NULL); - testCommandAssertProtocolTotal++; - hrnErrorThrowP(.message = testCommandAssertProtocolTotal <= 3 ? NULL : "ERR_MESSAGE_RETRY"); + hrnErrorThrowP(); // No FUNCTION_HARNESS_RETURN_VOID() because the function does not return } #define TEST_PROTOCOL_COMMAND_ERROR STRID5("error", 0x127ca450) +static unsigned int testCommandErrorProtocolTotal = 0; + __attribute__((__noreturn__)) static void testCommandErrorProtocol(PackRead *const param, ProtocolServer *const server) { @@ -53,7 +52,8 @@ testCommandErrorProtocol(PackRead *const param, ProtocolServer *const server) ASSERT(param == NULL); ASSERT(server != NULL); - hrnErrorThrowP(.errorType = &FormatError); + testCommandErrorProtocolTotal++; + hrnErrorThrowP(.errorType = &FormatError, .message = testCommandErrorProtocolTotal <= 2 ? NULL : "ERR_MESSAGE_RETRY"); // No FUNCTION_HARNESS_RETURN_VOID() because the function does not return } @@ -682,10 +682,10 @@ testRun(void) TEST_TITLE("command throws assert with retry messages"); TEST_ERROR( - protocolClientExecute(client, protocolCommandNew(TEST_PROTOCOL_COMMAND_ASSERT), false), AssertError, + protocolClientExecute(client, protocolCommandNew(TEST_PROTOCOL_COMMAND_ERROR), false), FormatError, "raised from test client: ERR_MESSAGE\n" - "[AssertError] on retry after 0ms\n" - "[AssertError] on retry after 500ms: ERR_MESSAGE_RETRY"); + "[FormatError] on retry after 0ms\n" + "[FormatError] on retry after 500ms: ERR_MESSAGE_RETRY"); // ----------------------------------------------------------------------------------------------------------------- TEST_TITLE("free client"); [parent: 8573a2df14d0]