redis 4.5.2 breaks bleeding edge unit tests
The nagios test breaks when run using redis v4.5.2
in the wheels unit tests (the "bleeding edge" tests). The error that pops up is pasted below. This may be related to a PR that is in 4.5.2, but I'm not sure. The workaround for now is to pin redis < 4.5.2 (!1116 (merged)), but if this is caused by new redis behavior that isn't a bug then we may need to make changes on our end to use newer versions of redis.
________________________________ test_nagios __________________________________
capsys = <_pytest.capture.CaptureFixture object at 0x7eff327739a0>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7eff3c572490>
request = <FixtureRequest for <Function test_nagios>>, socket_enabled = None
starter = <class 'gwcelery.tests.process.starter.<locals>.Starter'>
tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_nagios0')
def test_nagios(capsys, monkeypatch, request, socket_enabled, starter,
tmp_path):
mock_igwn_alert_client = Mock()
mock_hop_stream_object = Mock()
mock_hop_stream_object.configure_mock(**{'close.return_value': None})
mock_hop_stream = Mock(return_value=mock_hop_stream_object)
mock_list_topics = Mock()
unix_socket = str(tmp_path / 'redis.sock')
broker_url = f'redis+socket://{unix_socket}'
monkeypatch.setattr('hop.io.Stream.open', mock_hop_stream)
monkeypatch.setattr('igwn_alert.client', mock_igwn_alert_client)
monkeypatch.setattr('gwcelery.kafka.bootsteps.list_topics',
mock_list_topics)
monkeypatch.setitem(app.conf, 'broker_url', broker_url)
monkeypatch.setitem(app.conf, 'result_backend', broker_url)
# no broker
with pytest.raises(SystemExit) as excinfo:
main(['gwcelery', 'nagios'])
> assert excinfo.value.code == nagios.NagiosPluginStatus.CRITICAL
E AssertionError: assert <NagiosPluginStatus.UNKNOWN: 3> == <NagiosPluginStatus.CRITICAL: 2>
E + where <NagiosPluginStatus.UNKNOWN: 3> = SystemExit(<NagiosPluginStatus.UNKNOWN: 3>).code
E + where SystemExit(<NagiosPluginStatus.UNKNOWN: 3>) = <ExceptionInfo SystemExit(<NagiosPluginStatus.UNKNOWN: 3>) tblen=9>.value
E + and <NagiosPluginStatus.CRITICAL: 2> = <enum 'NagiosPluginStatus'>.CRITICAL
E + where <enum 'NagiosPluginStatus'> = nagios.NagiosPluginStatus
gwcelery/tests/test_tools_nagios.py:54: AssertionError
----------------------------- Captured stdout call -----------------------------
UNKNOWN: Unexpected error
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/kombu/transport/virtual/base.py", line 925, in create_channel
return self._avail_channels.pop()
IndexError: pop from empty list
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/redis/connection.py", line 1434, in get_connection
connection = self._available_connections.pop()
IndexError: pop from empty list
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/builds/emfollow/gwcelery/gwcelery/tools/nagios.py", line 156, in nagios
check_status(ctx.obj.app)
File "/builds/emfollow/gwcelery/gwcelery/tools/nagios.py", line 93, in check_status
connection.ensure_connection(max_retries=1)
File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 381, in ensure_connection
self._ensure_connection(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 433, in _ensure_connection
return retry_over_time(
File "/usr/local/lib/python3.9/site-packages/kombu/utils/functional.py", line 312, in retry_over_time
return fun(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 877, in _connection_factory
self._connection = self._establish_connection()
File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 812, in _establish_connection
conn = self.transport.establish_connection()
File "/usr/local/lib/python3.9/site-packages/kombu/transport/virtual/base.py", line 949, in establish_connection
self._avail_channels.append(self.create_channel(self))
File "/usr/local/lib/python3.9/site-packages/kombu/transport/virtual/base.py", line 927, in create_channel
channel = self.Channel(connection)
File "/usr/local/lib/python3.9/site-packages/kombu/transport/redis.py", line 737, in __init__
self.client.ping()
File "/usr/local/lib/python3.9/site-packages/redis/commands/core.py", line 1194, in ping
return self.execute_command("PING", **kwargs)
File "/usr/local/lib/python3.9/site-packages/redis/client.py", line 1255, in execute_command
conn = self.connection or pool.get_connection(command_name, **options)
File "/usr/local/lib/python3.9/site-packages/redis/connection.py", line 1436, in get_connection
connection = self.make_connection()
File "/usr/local/lib/python3.9/site-packages/redis/connection.py", line 1476, in make_connection
return self.connection_class(**self.connection_kwargs)
File "/usr/local/lib/python3.9/site-packages/redis/connection.py", line 1160, in __init__
super().__init__(**kwargs)
TypeError: __init__() got an unexpected keyword argument 'socket_timeout'
Edited by Cody Messick