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:
David Steele
2022-02-13 15:19:31 -06:00
parent 8573a2df14
commit 8d0cce66f8
2 changed files with 9 additions and 8 deletions
+1
View File
@@ -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"/>
+8 -8
View File
@@ -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");