From ae70eb08d2b72df5d6ecf86a0ca55b1a37bd6864 Mon Sep 17 00:00:00 2001 From: Simon de Vlieger Date: Tue, 1 Jul 2025 11:26:38 +0200 Subject: [PATCH] stages/ovf: test vbox_mac_address Test that different calls result in different mac addresses (with the same prefix), also test that when the correct options are passed that the mac address is returned as is. Signed-off-by: Simon de Vlieger --- stages/test/test_ovf.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/stages/test/test_ovf.py b/stages/test/test_ovf.py index 9285e63f..c8b41f16 100644 --- a/stages/test/test_ovf.py +++ b/stages/test/test_ovf.py @@ -65,3 +65,18 @@ def test_ovf_default_template(tmp_path, stage_module, test_opts, expected_substr for substring in expected_substrings: assert substring in expected_template_path.read_text() + + +def test_ovf_vbox_mac_address_differs(stage_module): + macs = [ + stage_module.vbox_mac_address({}), + stage_module.vbox_mac_address({}), + ] + + assert macs[0] != macs[1] + assert all(m.startswith("080027") for m in macs) + assert all(len(m) == 12 for m in macs) + + +def test_ovf_vbox_mac_address_options(stage_module): + assert stage_module.vbox_mac_address({"virtualbox": {"mac_address": "000000000000"}}) == "000000000000"