Make this test tolerant of more than one message

It is observing the log system.  It is reasonable to believe more than one log
event might come through over the course of the test.  We only need one, though.
This commit is contained in:
Jean-Paul Calderone 2020-10-16 13:15:45 -04:00
parent a22426011b
commit 7b02f58da0

View File

@ -53,7 +53,12 @@ class _StreamingLogClientProtocol(WebSocketClientProtocol):
self.factory.on_open.callback(self)
def onMessage(self, payload, isBinary):
self.on_message.callback(payload)
if self.on_message is None:
# Already did our job, ignore it
return
on_message = self.on_message
self.on_message = None
on_message.callback(payload)
def onClose(self, wasClean, code, reason):
self.on_close.callback(reason)