mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-06-20 01:17:49 +02:00
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.
This commit is contained in:
@@ -127,6 +127,7 @@
|
|||||||
|
|
||||||
<release-item>
|
<release-item>
|
||||||
<commit subject="Improve protocol module error test for protocolClientFree()."/>
|
<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-list>
|
||||||
<release-item-contributor id="david.steele"/>
|
<release-item-contributor id="david.steele"/>
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ Test protocol server command handlers
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define TEST_PROTOCOL_COMMAND_ASSERT STRID5("assert", 0x2922ce610)
|
#define TEST_PROTOCOL_COMMAND_ASSERT STRID5("assert", 0x2922ce610)
|
||||||
|
|
||||||
static unsigned int testCommandAssertProtocolTotal = 0;
|
|
||||||
|
|
||||||
__attribute__((__noreturn__)) static void
|
__attribute__((__noreturn__)) static void
|
||||||
testCommandAssertProtocol(PackRead *const param, ProtocolServer *const server)
|
testCommandAssertProtocol(PackRead *const param, ProtocolServer *const server)
|
||||||
{
|
{
|
||||||
@@ -34,14 +32,15 @@ testCommandAssertProtocol(PackRead *const param, ProtocolServer *const server)
|
|||||||
ASSERT(param == NULL);
|
ASSERT(param == NULL);
|
||||||
ASSERT(server != NULL);
|
ASSERT(server != NULL);
|
||||||
|
|
||||||
testCommandAssertProtocolTotal++;
|
hrnErrorThrowP();
|
||||||
hrnErrorThrowP(.message = testCommandAssertProtocolTotal <= 3 ? NULL : "ERR_MESSAGE_RETRY");
|
|
||||||
|
|
||||||
// No FUNCTION_HARNESS_RETURN_VOID() because the function does not return
|
// No FUNCTION_HARNESS_RETURN_VOID() because the function does not return
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TEST_PROTOCOL_COMMAND_ERROR STRID5("error", 0x127ca450)
|
#define TEST_PROTOCOL_COMMAND_ERROR STRID5("error", 0x127ca450)
|
||||||
|
|
||||||
|
static unsigned int testCommandErrorProtocolTotal = 0;
|
||||||
|
|
||||||
__attribute__((__noreturn__)) static void
|
__attribute__((__noreturn__)) static void
|
||||||
testCommandErrorProtocol(PackRead *const param, ProtocolServer *const server)
|
testCommandErrorProtocol(PackRead *const param, ProtocolServer *const server)
|
||||||
{
|
{
|
||||||
@@ -53,7 +52,8 @@ testCommandErrorProtocol(PackRead *const param, ProtocolServer *const server)
|
|||||||
ASSERT(param == NULL);
|
ASSERT(param == NULL);
|
||||||
ASSERT(server != 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
|
// 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_TITLE("command throws assert with retry messages");
|
||||||
|
|
||||||
TEST_ERROR(
|
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"
|
"raised from test client: ERR_MESSAGE\n"
|
||||||
"[AssertError] on retry after 0ms\n"
|
"[FormatError] on retry after 0ms\n"
|
||||||
"[AssertError] on retry after 500ms: ERR_MESSAGE_RETRY");
|
"[FormatError] on retry after 500ms: ERR_MESSAGE_RETRY");
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("free client");
|
TEST_TITLE("free client");
|
||||||
|
|||||||
Reference in New Issue
Block a user