Skip to content

Commit 6704797

Browse files
bchaliosroypat
authored andcommitted
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 <[email protected]>
1 parent e49a8dc commit 6704797

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/integration_tests/functional/test_cpu_template_helper.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,21 @@ def test_cpu_config_dump_vs_actual(
285285
microvm = microvm_factory.build(guest_kernel, rootfs)
286286
microvm.spawn()
287287
microvm.basic_config()
288-
microvm.add_net_iface()
289288
vm_config_path = save_vm_config(microvm, tmp_path)
290289

291290
# Dump CPU config with the helper tool.
292291
cpu_config_path = tmp_path / "cpu_config.json"
293292
cpu_template_helper.template_dump(vm_config_path, cpu_config_path)
294293
dump_cpu_config = build_cpu_config_dict(cpu_config_path)
295294

295+
# Add the network interface after we dump the CPU config via
296+
# the CPU template helper tool. The tool creates a microVM with
297+
# the config we pass it. When we pass it network configuration, we
298+
# run in some sort of race condition with TAP device creation.
299+
# CPU template helper tool doesn't need the network device configuration
300+
# so, add it to `microvm` after we have dumped the CPU config.
301+
microvm.add_net_iface()
302+
296303
# Retrieve actual CPU config from guest
297304
microvm.start()
298305
actual_cpu_config = {

0 commit comments

Comments
 (0)