From 670479798481d8edb84f3cb32d4468290e8ef762 Mon Sep 17 00:00:00 2001 From: Babis Chalios Date: Fri, 1 Dec 2023 12:26:44 +0000 Subject: [PATCH] fix(test): do not pass network config to CPU template helper CPU template helper tool uses a microVM configuration we pass to it to launch a VM and get it's CPU config. Our integration test that drives that needs to configure the microVM with a network interface so that it can SSH into it and run commands. However, when we pass to helper tool a configuration that includes networking, we run into a race-condition with creating/configuring a TAP device. This commit passes a microVM configuration without a network interface to the helper tool to avoid the race. Signed-off-by: Babis Chalios --- .../functional/test_cpu_template_helper.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/integration_tests/functional/test_cpu_template_helper.py b/tests/integration_tests/functional/test_cpu_template_helper.py index 8c4dbcb1bcd..e73f101ae36 100644 --- a/tests/integration_tests/functional/test_cpu_template_helper.py +++ b/tests/integration_tests/functional/test_cpu_template_helper.py @@ -285,7 +285,6 @@ def test_cpu_config_dump_vs_actual( microvm = microvm_factory.build(guest_kernel, rootfs) microvm.spawn() microvm.basic_config() - microvm.add_net_iface() vm_config_path = save_vm_config(microvm, tmp_path) # Dump CPU config with the helper tool. @@ -293,6 +292,14 @@ def test_cpu_config_dump_vs_actual( cpu_template_helper.template_dump(vm_config_path, cpu_config_path) dump_cpu_config = build_cpu_config_dict(cpu_config_path) + # Add the network interface after we dump the CPU config via + # the CPU template helper tool. The tool creates a microVM with + # the config we pass it. When we pass it network configuration, we + # run in some sort of race condition with TAP device creation. + # CPU template helper tool doesn't need the network device configuration + # so, add it to `microvm` after we have dumped the CPU config. + microvm.add_net_iface() + # Retrieve actual CPU config from guest microvm.start() actual_cpu_config = {