1
0
mirror of https://github.com/home-assistant/operating-system.git synced 2025-12-24 20:35:31 +00:00

Test landing page is reachable without internet connection (#3499)

* Test landing page is reachable without internet connection

Add test that checks user is able to access the landing page even when HAOS has
no internet connection. We still need some sort of outgoing connectivity, so
outgoing connection attempts don't end up with "network is unreachable". To
simulate this, restricted network is created for the QEMU instance used in the
test, and when everything is started, unresponsive default gateway is added.

This intents to test regression that was fixed by
home-assistant/supervisor#5204, Supervisor 2024.7.0+ is thus needed for this
test to pass.

* Bump requirements for tests
This commit is contained in:
Jan Čermák
2024-08-06 11:02:59 +02:00
committed by GitHub
parent 9cc45f65ea
commit 66fc7d7e2a
4 changed files with 81 additions and 5 deletions

View File

@@ -9,6 +9,18 @@ import pytest
logger = logging.getLogger(__name__)
@pytest.fixture(scope="function")
def without_internet(strategy):
default_nic = strategy.qemu.nic
if strategy.status.name == "shell":
strategy.transition("off")
strategy.qemu.nic = "user,net=192.168.76.0/24,dhcpstart=192.168.76.10,restrict=yes"
strategy.transition("shell")
yield
strategy.transition("off")
strategy.qemu.nic = default_nic
@pytest.fixture(autouse=True, scope="module")
def restart_qemu(strategy):
"""Use fresh QEMU instance for each module."""