2
0

Fix unexpected EOF failure for StartupMessage

This commit is contained in:
Yuli Khodorkovskiy
2021-07-06 21:35:21 -04:00
committed by Jack Christensen
parent 6bce4a1878
commit 033ca7d47f
+6 -2
View File
@@ -50,8 +50,12 @@ func TestBackendReceiveUnexpectedEOF(t *testing.T) {
assert.Nil(t, msg)
assert.Equal(t, io.ErrUnexpectedEOF, err)
// Receive FE msg
server.push([]byte{'F', 0, 0, 0, 6})
// Receive StartupMessage msg
dst := []byte{}
dst = pgio.AppendUint32(dst, 1000) // tell the backend we expect 1000 bytes to be read
dst = pgio.AppendUint32(dst, 1) // only send 1 byte
server.push(dst)
msg, err = backend.ReceiveStartupMessage()
assert.Nil(t, msg)
assert.Equal(t, io.ErrUnexpectedEOF, err)