Skip to content

Commit e49a8dc

Browse files
committed
test: enable entropy device for boot tests
Enable entropy device during boot time tests to check for entropy effects in the boot time of microVM. Signed-off-by: Babis Chalios <[email protected]>
1 parent e03ae44 commit e49a8dc

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tests/framework/microvm.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ def basic_config(
633633
track_dirty_pages: bool = False,
634634
rootfs_io_engine=None,
635635
cpu_template: Optional[str] = None,
636+
enable_entropy_device=False,
636637
):
637638
"""Shortcut for quickly configuring a microVM.
638639
@@ -690,6 +691,9 @@ def basic_config(
690691
io_engine=rootfs_io_engine,
691692
)
692693

694+
if enable_entropy_device:
695+
self.enable_entropy_device()
696+
693697
def add_drive(
694698
self,
695699
drive_id,
@@ -876,6 +880,10 @@ def restore_from_snapshot(
876880
)
877881
return True
878882

883+
def enable_entropy_device(self):
884+
"""Enable entropy device for microVM"""
885+
self.api.entropy.put()
886+
879887
def restore_from_path(self, snap_dir: Path, **kwargs):
880888
"""Restore snapshot from a path"""
881889
return self.restore_from_snapshot(Snapshot.load_from(snap_dir), **kwargs)

tests/integration_tests/performance/test_boottime.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def _configure_and_run_vm(microvm, network=False, initrd=False):
129129
"vcpu_count": 1,
130130
"mem_size_mib": 128,
131131
"boot_args": DEFAULT_BOOT_ARGS + " init=/usr/local/bin/init",
132+
"enable_entropy_device": True,
132133
}
133134
if initrd:
134135
config["add_root_device"] = False
@@ -186,6 +187,7 @@ def test_boottime(
186187
vcpu_count=vcpu_count,
187188
mem_size_mib=mem_size_mib,
188189
boot_args=DEFAULT_BOOT_ARGS + " init=/usr/local/bin/init",
190+
enable_entropy_device=True,
189191
)
190192
vm.add_net_iface()
191193
vm.start()

0 commit comments

Comments
 (0)