Skip to content

Commit

Permalink
test: enable entropy device for boot tests
Browse files Browse the repository at this point in the history
Enable entropy device during boot time tests to check for entropy
effects in the boot time of microVM.

Signed-off-by: Babis Chalios <bchalios@amazon.es>
  • Loading branch information
bchalios committed Dec 1, 2023
1 parent e03ae44 commit e49a8dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/framework/microvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ def basic_config(
track_dirty_pages: bool = False,
rootfs_io_engine=None,
cpu_template: Optional[str] = None,
enable_entropy_device=False,
):
"""Shortcut for quickly configuring a microVM.
Expand Down Expand Up @@ -690,6 +691,9 @@ def basic_config(
io_engine=rootfs_io_engine,
)

if enable_entropy_device:
self.enable_entropy_device()

def add_drive(
self,
drive_id,
Expand Down Expand Up @@ -876,6 +880,10 @@ def restore_from_snapshot(
)
return True

def enable_entropy_device(self):
"""Enable entropy device for microVM"""
self.api.entropy.put()

def restore_from_path(self, snap_dir: Path, **kwargs):
"""Restore snapshot from a path"""
return self.restore_from_snapshot(Snapshot.load_from(snap_dir), **kwargs)
Expand Down
2 changes: 2 additions & 0 deletions tests/integration_tests/performance/test_boottime.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def _configure_and_run_vm(microvm, network=False, initrd=False):
"vcpu_count": 1,
"mem_size_mib": 128,
"boot_args": DEFAULT_BOOT_ARGS + " init=/usr/local/bin/init",
"enable_entropy_device": True,
}
if initrd:
config["add_root_device"] = False
Expand Down Expand Up @@ -186,6 +187,7 @@ def test_boottime(
vcpu_count=vcpu_count,
mem_size_mib=mem_size_mib,
boot_args=DEFAULT_BOOT_ARGS + " init=/usr/local/bin/init",
enable_entropy_device=True,
)
vm.add_net_iface()
vm.start()
Expand Down

0 comments on commit e49a8dc

Please sign in to comment.