Verified Commit 7dde2147 authored by Karel Koci's avatar Karel Koci 🤘 Committed by Karel Koci
Browse files

tests/mark: add set of simple marks based on board mark

The idea behind this is that we have more descriptive names of marks and
thus it should be easier to understand why some tests are marked with
given combination of boards as they are.
At the same time it should be easier to go trough them at one location
once we add new boards. The new board would have to be selectively added
to appropriate marks and all tests using these marks would be
automatically handled. Of course that does not solve it fully but still
it reduces the burden on introducing new boards.
parent 4f971f15
"""These are shortcuts for various marks. Idea behind this is to give some of the marks combination more descriptive
name.
"""
import pytest
# Exclusive for boards
only_turris1x = pytest.mark.board("turris1x")
only_omnia = pytest.mark.board("omnia")
only_mox = pytest.mark.board("mox")
not_turris1x = pytest.mark.not_board("turris1x")
not_omnia = pytest.mark.not_board("omnia")
not_mox = pytest.mark.not_board("mox")
# Default DNS resolver
kresd = not_turris1x
unbound = only_turris1x
# Board capabalities
rainbow = pytest.mark.board("omnia", "turrix1x")
low_ram = pytest.mark.board("mox")
atsha = pytest.mark.board("omnia", "turrix1x")
otp = pytest.mark.board("mox")
......@@ -6,6 +6,7 @@ import pytest
from nsfarm.lxd import Container
from nsfarm.cli import Shell
from nsfarm.toolbox import service_is_running
from . import mark
@pytest.mark.deploy
......@@ -19,8 +20,8 @@ def test_syslog_ng(client_board):
@pytest.mark.parametrize("process", [
"crond",
"dnsmasq",
pytest.param("kresd", marks=pytest.mark.not_board("turris1x")),
pytest.param("unbound", marks=pytest.mark.board("turris1x")),
pytest.param("kresd", marks=mark.kresd),
pytest.param("unbound", marks=mark.unbound),
"lighttpd",
"mosquitto",
"netifd",
......@@ -57,8 +58,8 @@ basic_services = [
@pytest.mark.deploy
@pytest.mark.parametrize("service", basic_services + [
pytest.param("kresd", marks=pytest.mark.not_board("turris1x")),
pytest.param("unbound", marks=pytest.mark.board("turris1x")),
pytest.param("kresd", marks=mark.kresd),
pytest.param("unbound", marks=mark.unbound),
])
def test_running_services(client_board, service):
"""Check that various essential services are running.
......@@ -72,10 +73,10 @@ def test_running_services(client_board, service):
"done",
"gpio_switch",
"led",
pytest.param("mox_autosetup", marks=pytest.mark.board("mox")),
pytest.param("rainbow", marks=pytest.mark.not_board("mox")),
pytest.param("mox_autosetup", marks=mark.only_mox),
pytest.param("rainbow", marks=mark.rainbow),
"resolver",
pytest.param("setup_led", marks=pytest.mark.board("turris1x")),
pytest.param("setup_led", marks=mark.only_turris1x),
"srv",
"sysctl",
"sysfixtime",
......@@ -83,10 +84,10 @@ def test_running_services(client_board, service):
"system",
"ucitrack",
"umount",
pytest.param("update_mac", marks=pytest.mark.board("turris1x")),
pytest.param("update_mac", marks=mark.only_turris1x),
"updater-journal-recover",
"urandom_seed",
pytest.param("zram", marks=pytest.mark.board("mox")),
pytest.param("zram", marks=mark.low_ram),
])
def test_services(client_board, service):
"""Check that various essential services are enabled.
......
......@@ -3,12 +3,13 @@ The backend is different depending on board but common crypto-wrapper unites the
attribute access.
"""
import pytest
from . import mark
@pytest.mark.deploy
@pytest.mark.parametrize("hwtype", [
pytest.param("atsha", marks=pytest.mark.board("omnia", "turris1x")),
pytest.param("otp", marks=pytest.mark.board("mox")),
pytest.param("atsha", marks=mark.atsha),
pytest.param("otp", marks=mark.otp),
])
def test_hw_type(hwtype, client_board):
"""Check if reported hardware type matches board.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment