-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Improve KafkaConnection with more tests #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -55,6 +55,7 @@ def __init__(self, host, port, timeout=DEFAULT_SOCKET_TIMEOUT_SECONDS): | |||
self.host = host | |||
self.port = port | |||
self.timeout = timeout | |||
self._dirty = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason this is None
instead of False
? True|False
is used everywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_dirty is a description of the state of our socket in _sock. Because we dont have a _sock yet, we also dont really have a _dirty state either. But to be consistent we should probably set also _dirty to None in close() when we set _sock to None
…ests for __init__ and send
…a return val check in KafkaConnection.send()
… into try block in conn.recv
…cket payloads, then '', then error
Improve KafkaConnection with more tests
According to [rfc5802](https://datatracker.ietf.org/doc/html/rfc5802), username should escape special characters before sending to the server. > The characters ',' or '=' in usernames are sent as '=2C' and '=3D' respectively. If the server receives a username that contains '=' not followed by either '2C' or '3D', then the server MUST fail the authentication.
Handle connection failures in KafkaConnection.reinit
Set _sock=None in close()
Also check for no _sock when checking for _dirty
Add a few more debugging log messages
Implement the skipped connection tests in test/test_conn.py