diff --git a/plinth/modules/storage/tests/test_functional.py b/plinth/modules/storage/tests/test_functional.py index 157f792c4..0d7741f04 100644 --- a/plinth/modules/storage/tests/test_functional.py +++ b/plinth/modules/storage/tests/test_functional.py @@ -2,6 +2,7 @@ """ Functional, browser based tests for storage app. """ +import pytest from pytest_bdd import given, parsers, scenarios, then @@ -17,7 +18,10 @@ def storage_root_disk_is_shown(session_browser): @given(parsers.parse("I'm on the {name:w} page")) def go_to_module(session_browser, name): - functional.nav_to_module(session_browser, name) + if functional.running_inside_container: + pytest.skip('Storage doesn\'t work inside a container') + else: + functional.nav_to_module(session_browser, name) def _is_root_disk_shown(browser): diff --git a/plinth/tests/functional/__init__.py b/plinth/tests/functional/__init__.py index b3c14d9c3..85d330e39 100644 --- a/plinth/tests/functional/__init__.py +++ b/plinth/tests/functional/__init__.py @@ -7,6 +7,7 @@ import configparser import logging import os import pathlib +import subprocess import tempfile import time from contextlib import contextmanager @@ -424,6 +425,13 @@ def service_is_not_running(browser, app_name): return len(browser.find_by_id('service-not-running')) != 0 +def running_inside_container(): + """Check if freedombox is running inside a container""" + result = subprocess.run(['systemd-detect-virt', '--container'], + stdout=subprocess.PIPE) + return bool(result.stdout.decode('utf-8').lower() != "none\n") + + ############################## # System -> Config utilities # ##############################