Pin redis < 3.2.0
The recent redis-py update from 3.1.0 to 3.2.0 broke the following unit test:
_________________________________ test_nagios __________________________________
capsys = <_pytest.capture.CaptureFixture object at 0x7f071357f400>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f07133e9668>
socket_enabled = None
starter = <class 'gwcelery.tests.process.starter.<locals>.Starter'>
tmpdir = local('/tmp/pytest-of-root/pytest-0/test_nagios0')
def test_nagios(capsys, monkeypatch, socket_enabled,
starter, tmpdir):
mock_lvalert_client = Mock()
monkeypatch.setattr('sleek_lvalert.LVAlertClient', mock_lvalert_client)
# no broker
unix_socket = str(tmpdir / 'sock')
monkeypatch.setenv('CELERY_BROKER_URL', 'redis+socket://' + unix_socket)
with pytest.raises(SystemExit) as excinfo:
app.start(['gwcelery', 'nagios'])
assert excinfo.value.code == nagios.NagiosPluginStatus.CRITICAL
out, err = capsys.readouterr()
assert 'CRITICAL: No connection to broker' in out
# broker, no worker
redis_server = find_executable('redis-server')
if redis_server is None:
pytest.skip('redis-server is not installed')
starter.exec_process(
[redis_server, '--port', '0', '--unixsocket', unix_socket,
'--unixsocketperm', '700'], timeout=10,
magic_words=b'The server is now ready to accept connections')
with pytest.raises(SystemExit) as excinfo:
app.start(['gwcelery', 'nagios'])
assert excinfo.value.code == nagios.NagiosPluginStatus.CRITICAL
out, err = capsys.readouterr()
assert 'CRITICAL: Not all expected queues are active' in out
# worker, no tasks
starter.python_process(
args=(['gwcelery', 'worker', '-l', 'info',
'-Q', 'celery,exttrig,openmp,superevent'],),
target=app.start, timeout=10, magic_words=b'ready.')
with pytest.raises(SystemExit) as excinfo:
app.start(['gwcelery', 'nagios'])
assert excinfo.value.code == nagios.NagiosPluginStatus.CRITICAL
out, err = capsys.readouterr()
> assert 'CRITICAL: Not all expected tasks are active' in out
E AssertionError: assert 'CRITICAL: Not all expected tasks are active' in 'CRITICAL: Not all expected queues are active\nAssertionError: Missing queues: exttrig, openmp, celery, superevent\n\n'
gwcelery/tests/test_tools_nagios.py:66: AssertionError