CI: Run pytest sequentially, clean up test markers
This commit is contained in:
parent
e8d89d6a42
commit
382073db78
24 changed files with 15 additions and 95 deletions
2
.github/workflows/docker-tests.yml
vendored
2
.github/workflows/docker-tests.yml
vendored
|
@ -112,4 +112,4 @@ jobs:
|
|||
CROWDSEC_TEST_TIMEOUT: 90
|
||||
run: |
|
||||
cd docker/test
|
||||
pipenv run pytest -n 2 --durations=0 --color=yes
|
||||
pipenv run pytest -n 1 --durations=0 --color=yes
|
||||
|
|
7
Makefile
7
Makefile
|
@ -63,9 +63,14 @@ all: clean test build
|
|||
.PHONY: plugins
|
||||
plugins: http-plugin slack-plugin splunk-plugin email-plugin dummy-plugin
|
||||
|
||||
# same as "$(MAKE) -f debian/rules clean" but without the dependency on debhelper
|
||||
.PHONY: clean-debian
|
||||
clean-debian:
|
||||
$(MAKE) -f debian/rules clean
|
||||
@$(RM) -r debian/crowdsec
|
||||
@$(RM) -r debian/files
|
||||
@$(RM) -r debian/.debhelper
|
||||
@$(RM) -r debian/*.substvars
|
||||
@$(RM) -r debian/*-stamp
|
||||
|
||||
.PHONY: clean
|
||||
clean: clean-test
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
[pytest]
|
||||
# run all tests sequentially, drop to pdb on first failure
|
||||
addopts = -n 0 --no-header --pdb --pdbcls=IPython.terminal.debugger:Pdb
|
||||
env_files =
|
||||
.env
|
||||
default.env
|
|
@ -1,7 +1,13 @@
|
|||
[pytest]
|
||||
# run all tests in parallel, compact output
|
||||
addopts = -n 4 --no-header -m "not (deb or rpm)"
|
||||
required_plugins = pytest-xdist
|
||||
addopts =
|
||||
--pdbcls=IPython.terminal.debugger:Pdb
|
||||
--strict-markers
|
||||
-m "not (deb or rpm)"
|
||||
-n auto
|
||||
markers:
|
||||
deb: tests for .deb packaging
|
||||
rpm: tests for .rpm packaging
|
||||
env_files =
|
||||
.env
|
||||
default.env
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
|
||||
pytest_plugins = ("cs",)
|
||||
|
||||
|
||||
def pytest_configure(config):
|
||||
config.addinivalue_line(
|
||||
'markers', 'deb: tests for build/install/configure a debian packages'
|
||||
)
|
||||
config.addinivalue_line(
|
||||
'markers', 'rpm: tests for build/install/configure rpm packages'
|
||||
)
|
||||
config.addinivalue_line(
|
||||
'markers', 'docker: mark tests for lone or manually orchestrated containers'
|
||||
)
|
||||
config.addinivalue_line(
|
||||
'markers', 'compose: mark tests for docker compose projects'
|
||||
)
|
|
@ -2,10 +2,6 @@
|
|||
|
||||
from http import HTTPStatus
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_no_agent(crowdsec, flavor):
|
||||
"""Test DISABLE_AGENT=true"""
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
from http import HTTPStatus
|
||||
import random
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_split_lapi_agent(crowdsec, flavor):
|
||||
rand = str(random.randint(0, 10000))
|
||||
|
|
|
@ -8,10 +8,6 @@ import hashlib
|
|||
from http import HTTPStatus
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def hex512(s):
|
||||
"""Return the sha512 hash of a string as a hex string"""
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
|
||||
from http import HTTPStatus
|
||||
|
||||
import pytest
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_no_capi(crowdsec, flavor):
|
||||
"""Test no CAPI (disabled by default in tests)"""
|
||||
|
|
|
@ -4,10 +4,6 @@ import datetime
|
|||
|
||||
from pytest_cs import Status
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_cold_logs(crowdsec, tmp_path_factory, flavor):
|
||||
env = {
|
||||
|
|
|
@ -6,10 +6,6 @@ Test basic behavior of all the image variants
|
|||
|
||||
from http import HTTPStatus
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_cscli_lapi(crowdsec, flavor):
|
||||
"""Test if cscli can talk to lapi"""
|
||||
|
|
|
@ -6,10 +6,6 @@ Smoke tests in case docker is not set up correctly or has connection issues.
|
|||
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_docker_cli_run():
|
||||
"""Test if docker run works from the command line. Capture stdout too"""
|
||||
|
|
|
@ -7,10 +7,6 @@ Test pre-installed hub items.
|
|||
from http import HTTPStatus
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_preinstalled_hub(crowdsec, flavor):
|
||||
"""Test hub objects installed in the entrypoint"""
|
||||
|
|
|
@ -9,11 +9,8 @@ import json
|
|||
import os
|
||||
import pwd
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_install_two_collections(crowdsec, flavor):
|
||||
"""Test installing collections at startup"""
|
||||
|
|
|
@ -7,10 +7,6 @@ Test parser management
|
|||
from http import HTTPStatus
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_install_two_parsers(crowdsec, flavor):
|
||||
"""Test installing parsers at startup"""
|
||||
|
|
|
@ -8,8 +8,6 @@ from http import HTTPStatus
|
|||
import json
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_install_two_postoverflows(crowdsec, flavor):
|
||||
"""Test installing postoverflows at startup"""
|
||||
|
|
|
@ -7,10 +7,6 @@ Test scenario management
|
|||
from http import HTTPStatus
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_install_two_scenarios(crowdsec, flavor):
|
||||
"""Test installing scenarios at startup"""
|
||||
|
|
|
@ -4,8 +4,6 @@ from http import HTTPStatus
|
|||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_local_api_url_default(crowdsec, flavor):
|
||||
"""Test LOCAL_API_URL (default)"""
|
||||
|
|
|
@ -4,8 +4,6 @@ from http import HTTPStatus
|
|||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_metrics_port_default(crowdsec, flavor):
|
||||
"""Test metrics"""
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
|
||||
from pytest_cs import Status
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_no_agent(crowdsec, flavor):
|
||||
"""Test DISABLE_LOCAL_API=true (failing stand-alone container)"""
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
# XXX this is redundant, already tested in pytest_cs
|
||||
def test_crowdsec(crowdsec, flavor):
|
||||
|
|
|
@ -8,10 +8,6 @@ import random
|
|||
|
||||
from pytest_cs import Status
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_missing_key_file(crowdsec, flavor):
|
||||
"""Test that cscli and agent can communicate to LAPI with TLS"""
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_version_docker_platform(crowdsec, flavor):
|
||||
with crowdsec(flavor=flavor) as cs:
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
|
||||
from http import HTTPStatus
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_use_wal_default(crowdsec, flavor):
|
||||
"""Test USE_WAL default"""
|
||||
|
|
Loading…
Reference in a new issue