Skip to content

Commit fbf24fe

Browse files
committed
test: avoid filing negative tests due to api server not starting
Some negative tests check for a failure mode that happens before we can print the "API server started" log message, which then causes issues in Microvm.spawn(). Work around this by adjusting some except clauses (it seems that even in the past we ran into this issue due to the old "does api socket file exist" check), or setting the log level to WARN, which also disables the "api server started" check. A special case if the describe snapshot version check, which runs into issues because the "api server started" log message is fairly new (1.12), and some older firecrackers do not print it. Signed-off-by: Patrick Roy <[email protected]>
1 parent acc7044 commit fbf24fe

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

tests/integration_tests/functional/test_api_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_api_socket_in_use(uvm_plain):
2323

2424
sock = socket.socket(socket.AF_UNIX)
2525
sock.bind(microvm.jailer.api_socket_path())
26-
microvm.spawn()
26+
microvm.spawn(log_level="warn")
2727
msg = "Failed to open the API socket at: /run/firecracker.socket. Check that it is not already used."
2828
microvm.check_log_message(msg)
2929

tests/integration_tests/functional/test_cmd_line_parameters.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def test_describe_snapshot_all_versions(
2828
fc_binary_path=firecracker_release.path,
2929
jailer_binary_path=firecracker_release.jailer,
3030
)
31-
vm.spawn()
31+
# FIXME: Once only FC versions >= 1.12 are supported, drop log_level="warn"
32+
vm.spawn(log_level="warn")
3233
vm.basic_config(track_dirty_pages=True)
3334
vm.start()
3435
snapshot = vm.snapshot_diff()

tests/integration_tests/functional/test_cmd_line_start.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ def test_start_with_missing_metadata(uvm_plain):
371371

372372
try:
373373
test_microvm.spawn()
374-
except FileNotFoundError:
374+
except: # pylint: disable=bare-except
375375
pass
376376
finally:
377377
test_microvm.check_log_message(
@@ -394,7 +394,7 @@ def test_start_with_invalid_metadata(uvm_plain):
394394

395395
try:
396396
test_microvm.spawn()
397-
except FileNotFoundError:
397+
except: # pylint: disable=bare-except
398398
pass
399399
finally:
400400
test_microvm.check_log_message("MMDS error: metadata provided not valid json")

0 commit comments

Comments
 (0)