ci: Workaround for ip netns bug in container.
Due to `ip netns` issue in https://github.com/containers/podman/issues/11887 , `ip netns exec` will fail in podman container. To workaround it, mount another sysfs to random folder workaround this problem. Signed-off-by: Gris Ge <fge@redhat.com>
This commit is contained in:
parent
a14bdcca61
commit
a2303e2ce4
@ -20,6 +20,7 @@
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
import warnings
|
||||
|
||||
import pytest
|
||||
@ -70,6 +71,20 @@ def _mark_tier2_tests(items):
|
||||
item.add_marker(pytest.mark.tier2)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def fix_ip_netns_issue(scope="session", autouse=True):
|
||||
if os.getenv("CI"):
|
||||
with tempfile.TemporaryDirectory() as tmpdirname:
|
||||
subprocess.run(
|
||||
f"mount -t sysfs --make-private {tmpdirname}".split(),
|
||||
check=True,
|
||||
)
|
||||
yield
|
||||
subprocess.run(f"umount {tmpdirname}".split())
|
||||
else:
|
||||
yield
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def test_env_setup():
|
||||
_logging_setup()
|
||||
|
Loading…
x
Reference in New Issue
Block a user