From abc6ed7391cf7a918488a6dfb30cd81d1618c600 Mon Sep 17 00:00:00 2001 From: MrKevinWeiss Date: Wed, 31 Jan 2024 09:45:19 +0100 Subject: [PATCH] conftest: Randomize default PAN_ID Due to some issues with other border routers running we should harden the tests against that by using a random PAN_ID. --- conftest.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/conftest.py b/conftest.py index e6aae43..f40a3fc 100644 --- a/conftest.py +++ b/conftest.py @@ -6,6 +6,7 @@ See https://docs.pytest.org/en/stable/fixture.html#conftest-py-sharing-fixture-functions """ # noqa: E501 +import random import re import os import subprocess @@ -29,6 +30,7 @@ RIOTBASE = os.environ.get('RIOTBASE') RUNNING_CTRLS = [] RUNNING_EXPERIMENTS = [] +DEFAULT_PAN_ID = str(random.randint(0, 0xFFFD)) def pytest_addoption(parser): @@ -321,6 +323,12 @@ def update_env(node, modules=None, cflags=None, port=None, termflags=None, extra node.env.get('DOCKER_ENVIRONMENT_CMDLINE', '') + f" -e 'USEMODULE={node.env['USEMODULE']}'" ) + node.env['DEFAULT_PAN_ID'] = DEFAULT_PAN_ID + if os.environ.get('BUILD_IN_DOCKER', 0) == '1': + node.env['DOCKER_ENVIRONMENT_CMDLINE'] = ( + node.env.get('DOCKER_ENVIRONMENT_CMDLINE', '') + + f" -e 'DEFAULT_PAN_ID={node.env['DEFAULT_PAN_ID']}'" + ) if cflags is not None: node.env['CFLAGS'] = cflags if port is not None: