github.com/crowdsecurity/crowdsec@v1.6.1/docker/test/tests/test_wal.py (about)

     1  #!/usr/bin/env python
     2  
     3  from http import HTTPStatus
     4  
     5  import pytest
     6  
     7  pytestmark = pytest.mark.docker
     8  
     9  
    10  def test_use_wal_default(crowdsec, flavor):
    11      """Test USE_WAL default"""
    12      with crowdsec(flavor=flavor) as cs:
    13          cs.wait_for_log("*Starting processing data*")
    14          cs.wait_for_http(8080, '/health', want_status=HTTPStatus.OK)
    15          res = cs.cont.exec_run('cscli config show --key Config.DbConfig.UseWal -o json')
    16          assert res.exit_code == 0
    17          stdout = res.output.decode()
    18          assert "false" in stdout
    19  
    20  
    21  def test_use_wal_true(crowdsec, flavor):
    22      """Test USE_WAL=true"""
    23      env = {
    24          'USE_WAL': 'true',
    25      }
    26      with crowdsec(flavor=flavor, environment=env) as cs:
    27          cs.wait_for_log("*Starting processing data*")
    28          cs.wait_for_http(8080, '/health', want_status=HTTPStatus.OK)
    29          res = cs.cont.exec_run('cscli config show --key Config.DbConfig.UseWal -o json')
    30          assert res.exit_code == 0
    31          stdout = res.output.decode()
    32          assert "true" in stdout
    33  
    34  
    35  def test_use_wal_false(crowdsec, flavor):
    36      """Test USE_WAL=false"""
    37      env = {
    38          'USE_WAL': 'false',
    39      }
    40      with crowdsec(flavor=flavor, environment=env) as cs:
    41          cs.wait_for_log("*Starting processing data*")
    42          cs.wait_for_http(8080, '/health', want_status=HTTPStatus.OK)
    43          res = cs.cont.exec_run('cscli config show --key Config.DbConfig.UseWal -o json')
    44          assert res.exit_code == 0
    45          stdout = res.output.decode()
    46          assert "false" in stdout