Add test for protocol greeting when a field is missing.
A missing field and a NULL field are not exactly the same so it seems best to test both.
Because of the way KeyValue objects work the error is the same, but that will not always be true.
@@ -490,6 +490,8 @@ testRun(void)
ioWriteFlush(HRN_FORK_CHILD_WRITE());
ioWriteStrLine(HRN_FORK_CHILD_WRITE(), STRDEF("{\"name\":null}"));
ioWriteFlush(HRN_FORK_CHILD_WRITE());
+ ioWriteStrLine(HRN_FORK_CHILD_WRITE(), STRDEF("{}"));
+ ioWriteFlush(HRN_FORK_CHILD_WRITE());
ioWriteStrLine(HRN_FORK_CHILD_WRITE(), STRDEF("{\"name\":\"bogus\"}"));
ioWriteFlush(HRN_FORK_CHILD_WRITE());
ioWriteStrLine(HRN_FORK_CHILD_WRITE(), STRDEF("{\"name\":\"pgBackRest\",\"service\":\"bogus\"}"));
@@ -564,6 +566,9 @@ testRun(void)
TEST_ERROR(
protocolClientNew(STRDEF("test client"), STRDEF("test"), HRN_FORK_PARENT_READ(0), HRN_FORK_PARENT_WRITE(0)),
ProtocolError, "unable to find greeting key 'name'");
+ TEST_ERROR(
+ protocolClientNew(STRDEF("test client"), STRDEF("test"), HRN_FORK_PARENT_READ(0), HRN_FORK_PARENT_WRITE(0)),
+ ProtocolError, "unable to find greeting key 'name'");
TEST_ERROR(
protocolClientNew(STRDEF("test client"), STRDEF("test"), HRN_FORK_PARENT_READ(0), HRN_FORK_PARENT_WRITE(0)),
ProtocolError,
