2023-02-20 13:55:56 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
from http import HTTPStatus
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
pytestmark = pytest.mark.docker
|
|
|
|
|
|
|
|
|
|
|
|
def test_use_wal_default(crowdsec, flavor):
|
|
|
|
"""Test USE_WAL default"""
|
2023-02-28 16:49:32 +00:00
|
|
|
with crowdsec(flavor=flavor) as cs:
|
|
|
|
cs.wait_for_log("*Starting processing data*")
|
|
|
|
cs.wait_for_http(8080, '/health', want_status=HTTPStatus.OK)
|
|
|
|
res = cs.cont.exec_run('cscli config show --key Config.DbConfig.UseWal -o json')
|
2023-02-20 13:55:56 +00:00
|
|
|
assert res.exit_code == 0
|
|
|
|
stdout = res.output.decode()
|
|
|
|
assert "false" in stdout
|
|
|
|
|
|
|
|
|
|
|
|
def test_use_wal_true(crowdsec, flavor):
|
|
|
|
"""Test USE_WAL=true"""
|
|
|
|
env = {
|
|
|
|
'USE_WAL': 'true',
|
|
|
|
}
|
2023-02-28 16:49:32 +00:00
|
|
|
with crowdsec(flavor=flavor, environment=env) as cs:
|
|
|
|
cs.wait_for_log("*Starting processing data*")
|
|
|
|
cs.wait_for_http(8080, '/health', want_status=HTTPStatus.OK)
|
|
|
|
res = cs.cont.exec_run('cscli config show --key Config.DbConfig.UseWal -o json')
|
2023-02-20 13:55:56 +00:00
|
|
|
assert res.exit_code == 0
|
|
|
|
stdout = res.output.decode()
|
|
|
|
assert "true" in stdout
|
|
|
|
|
|
|
|
|
|
|
|
def test_use_wal_false(crowdsec, flavor):
|
|
|
|
"""Test USE_WAL=false"""
|
|
|
|
env = {
|
|
|
|
'USE_WAL': 'false',
|
|
|
|
}
|
2023-02-28 16:49:32 +00:00
|
|
|
with crowdsec(flavor=flavor, environment=env) as cs:
|
|
|
|
cs.wait_for_log("*Starting processing data*")
|
|
|
|
cs.wait_for_http(8080, '/health', want_status=HTTPStatus.OK)
|
|
|
|
res = cs.cont.exec_run('cscli config show --key Config.DbConfig.UseWal -o json')
|
2023-02-20 13:55:56 +00:00
|
|
|
assert res.exit_code == 0
|
|
|
|
stdout = res.output.decode()
|
|
|
|
assert "false" in stdout
|