From 6d766ae8b7961fb0ca64639d5318dd29cccc3748 Mon Sep 17 00:00:00 2001 From: Viktor Kleen Date: Tue, 22 Mar 2022 00:16:07 +0000 Subject: [PATCH] nixos/test-driver: deduplicate VLANs Naively deduplicate VLANs in the python driver for NixOS tests. The current implementation accidentally works, since the VLan class mutates the environment. On construction it sets QEMU_VDE_SOCKET_${id} and this environment variable gets overwritten once a second VLAN with the same id is constructed. Because the NIC flags passed to qemu just use the QEMU_VDE_SOCKET_${id} environment variable, this implicitly chooses a single vde_switch process for each VLAN. However, this leads to unusable vde_switch processes being spawned in each test run and as a side effect makes it impossible to access the correct VLan objects in the interactive test driver. It also makes it remarkably hard to understand why the current implementation ever worked. --- nixos/lib/test-driver/test_driver/driver.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/lib/test-driver/test_driver/driver.py b/nixos/lib/test-driver/test_driver/driver.py index 880b1c5fdec..0e5f013193f 100644 --- a/nixos/lib/test-driver/test_driver/driver.py +++ b/nixos/lib/test-driver/test_driver/driver.py @@ -55,6 +55,7 @@ class Driver: tmp_dir = get_tmp_dir() with rootlog.nested("start all VLans"): + vlans = list(set(vlans)) self.vlans = [VLan(nr, tmp_dir) for nr in vlans] def cmd(scripts: List[str]) -> Iterator[NixStartScript]: