Skip to content

Commit 4ebca1e

Browse files
committed
test(microvm): add no_netns_reuse in build_n_from_snapshot
This is to be able to disable netns reuse to get consistent performance results. Signed-off-by: Nikita Kalyazin <[email protected]>
1 parent 033825d commit 4ebca1e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/framework/microvm.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,13 +1206,20 @@ def build_n_from_snapshot(
12061206
uffd_handler_name=None,
12071207
incremental=False,
12081208
use_snapshot_editor=True,
1209+
no_netns_reuse=False,
12091210
):
12101211
"""A generator of `n` microvms restored, either all restored from the same given snapshot
12111212
(incremental=False), or created by taking successive snapshots of restored VMs
12121213
"""
12131214
last_snapshot = None
12141215
for _ in range(nr_vms):
1215-
microvm = self.build()
1216+
microvm = self.build(
1217+
**(
1218+
{"netns": net_tools.NetNs(str(uuid.uuid4()))}
1219+
if no_netns_reuse
1220+
else {}
1221+
)
1222+
)
12161223
microvm.spawn()
12171224

12181225
snapshot_copy = microvm.restore_from_snapshot(

0 commit comments

Comments
 (0)