Skip to content

Commit 18bde87

Browse files
committed
refactor(test): stop accepting string in make_snapshot
Just always demand the enum. The internal conversion from str to enum now doesnt work anymore with the enum no longer being str-based. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
1 parent fcddb0c commit 18bde87

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/framework/microvm.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ def resume(self):
976976

977977
def make_snapshot(
978978
self,
979-
snapshot_type: SnapshotType | str,
979+
snapshot_type: SnapshotType,
980980
*,
981981
mem_path: str = "mem",
982982
vmstate_path="vmstate",
@@ -988,7 +988,6 @@ def make_snapshot(
988988
989989
It pauses the microvm before taking the snapshot.
990990
"""
991-
snapshot_type = SnapshotType(snapshot_type)
992991
self.pause()
993992
self.api.snapshot_create.put(
994993
mem_file_path=str(mem_path),
@@ -1011,11 +1010,15 @@ def make_snapshot(
10111010

10121011
def snapshot_diff(self, *, mem_path: str = "mem", vmstate_path="vmstate"):
10131012
"""Make a Diff snapshot"""
1014-
return self.make_snapshot("Diff", mem_path=mem_path, vmstate_path=vmstate_path)
1013+
return self.make_snapshot(
1014+
SnapshotType.DIFF, mem_path=mem_path, vmstate_path=vmstate_path
1015+
)
10151016

10161017
def snapshot_full(self, *, mem_path: str = "mem", vmstate_path="vmstate"):
10171018
"""Make a Full snapshot"""
1018-
return self.make_snapshot("Full", mem_path=mem_path, vmstate_path=vmstate_path)
1019+
return self.make_snapshot(
1020+
SnapshotType.FULL, mem_path=mem_path, vmstate_path=vmstate_path
1021+
)
10191022

10201023
def restore_from_snapshot(
10211024
self,

0 commit comments

Comments
 (0)