1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-30 05:39:12 +02:00

Improve protocol module error test for protocolClientFree().

Using an assert here was never ideal and won't work once we start handling fatal errors differently.
This commit is contained in:
David Steele 2022-02-13 15:11:59 -06:00
parent 551e5bc6f6
commit 8573a2df14
2 changed files with 15 additions and 2 deletions

View File

@ -125,6 +125,16 @@
<p>Improve small file support.</p>
</release-item>
<release-item>
<commit subject="Improve protocol module error test for protocolClientFree()."/>
<release-item-contributor-list>
<release-item-contributor id="david.steele"/>
</release-item-contributor-list>
<p>Do not retry fatal errors.</p>
</release-item>
<release-item>
<commit subject="Add ioBufferReadNewOpen() and ioBufferWriteNewOpen()."/>
<commit subject="Refactor lock code."/>

View File

@ -279,10 +279,13 @@ testRun(void)
// Create bogus client and exec to generate errors
ProtocolHelperClient protocolHelperClient = {0};
IoWrite *write = ioFdWriteNewOpen(STRDEF("invalid"), 0, 0);
OBJ_NEW_BEGIN(ProtocolClient)
{
protocolHelperClient.client = OBJ_NEW_ALLOC();
*protocolHelperClient.client = (ProtocolClient){.name = STRDEF("test"), .state = protocolClientStateIdle};
*protocolHelperClient.client = (ProtocolClient){
.name = STRDEF("test"), .state = protocolClientStateIdle, .write = write};
memContextCallbackSet(memContextCurrent(), protocolClientFreeResource, protocolHelperClient.client);
}
OBJ_NEW_END();
@ -298,7 +301,7 @@ testRun(void)
TEST_RESULT_VOID(protocolHelperClientFree(&protocolHelperClient), "free");
TEST_RESULT_LOG(
"P00 WARN: assertion 'write != NULL' failed\n"
"P00 WARN: unable to write to invalid: [9] Bad file descriptor\n"
"P00 WARN: unable to wait on child process: [10] No child processes");
}