]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
testing: handling non-root users with VNETs in pytest-based tests.
authorAlexander V. Chernikov <melifaro@FreeBSD.org>
Thu, 9 Feb 2023 14:31:34 +0000 (14:31 +0000)
committerAlexander V. Chernikov <melifaro@FreeBSD.org>
Thu, 9 Feb 2023 14:49:27 +0000 (14:49 +0000)
commit6332ef8941999b0c074d1ece0e1e108447c70b98
tree1368de67f276cfc623ca739e24f8e72ab6e7bae9
parent5a5436eb5d960b9e243f8196147c6a51ca4f9dee
testing: handling non-root users with VNETs in pytest-based tests.

Currently isolation and resource requirements are handled directly
 by the kyua runner, based on the requirements specified by the test.
It works well for simple tests, but may cause discrepancy with tests
 doing complex pre-setups. For example, all tests that perform
 VNET setups require root access to properly function.

This change adds additional handling of the "require_user" property
 within the python testing framework. Specifically, it requests
 root access if the test class signals its root requirements and
 drops privileges to the desired user after performing the pre-setup.

Differential Revision: https://reviews.freebsd.org/D37923
MFC after: 2 weeks
tests/atf_python/atf_pytest.py
tests/atf_python/sys/net/vnet.py
tests/atf_python/utils.py
tests/conftest.py