Skip to content

Commit

Permalink
test: refactor: rename wait_for_up to wait_for_ssh_up
Browse files Browse the repository at this point in the history
To indicate that we're really waiting until sshd is up and accepting
connections, as a proxy for the actual boot process.

Suggested during code review in #4798.

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
  • Loading branch information
roypat committed Sep 16, 2024
1 parent 6fee729 commit 6c70ece
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions tests/framework/microvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ def spawn(
if "no-api" not in self.jailer.extra_args:
self._wait_create()
if "config-file" in self.jailer.extra_args and self.iface:
self.wait_for_up()
self.wait_for_ssh_up()
if self.log_file and log_level in ("Trace", "Debug", "Info"):
self.check_log_message("Running Firecracker")

Expand Down Expand Up @@ -879,7 +879,7 @@ def start(self):
assert self.state == "Running"

if self.iface:
self.wait_for_up()
self.wait_for_ssh_up()

def pause(self):
"""Pauses the microVM"""
Expand Down Expand Up @@ -963,7 +963,7 @@ def restore_from_snapshot(
)
# This is not a "wait for boot", but rather a "VM still works after restoration"
if snapshot.net_ifaces and resume:
self.wait_for_up()
self.wait_for_ssh_up()
return jailed_snapshot

def enable_entropy_device(self):
Expand Down Expand Up @@ -1003,7 +1003,7 @@ def thread_backtraces(self):
)
return "\n".join(backtraces)

def wait_for_up(self, timeout=10):
def wait_for_ssh_up(self, timeout=10):
"""Wait for guest running inside the microVM to come up and respond.
:param timeout: seconds to wait.
Expand Down
4 changes: 2 additions & 2 deletions tests/integration_tests/functional/test_pause_resume.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ def test_pause_resume(uvm_nano):

# Verify guest is no longer active.
with pytest.raises(AssertionError):
microvm.wait_for_up()
microvm.wait_for_ssh_up()

# Verify emulation was indeed paused and no events from either
# guest or host side were handled.
verify_net_emulation_paused(microvm.flush_metrics())

# Verify guest is no longer active.
with pytest.raises(AssertionError):
microvm.wait_for_up()
microvm.wait_for_ssh_up()

# Pausing the microVM when it is already `Paused` is allowed
# (microVM remains in `Paused` state).
Expand Down

0 comments on commit 6c70ece

Please sign in to comment.