Skip to content

Commit 184dc54

Browse files
committed
fix(test): ignore failures dumping FC metrics during teardown
If the FlushMetrics fails during teardown, then this will hide any potential previous failures that might've resulted in Firecracker dying. Signed-off-by: Patrick Roy <[email protected]>
1 parent d912bb5 commit 184dc54

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/host_tools/fcmetrics.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import datetime
1111
import json
12+
import logging
1213
import math
1314
import platform
1415
import time
@@ -544,8 +545,14 @@ def stop(self):
544545
# this should also avoid any race condition leading to
545546
# uploading the same metrics twice
546547
self.join()
547-
self.vm.api.actions.put(action_type="FlushMetrics")
548-
self._flush_metrics()
548+
try:
549+
self.vm.api.actions.put(action_type="FlushMetrics")
550+
except: # pylint: disable=bare-except
551+
# if this doesn't work, ignore the failure. This function is called during teardown,
552+
# and if it fails there, then the resulting exception hides the actual test failure.
553+
logging.error("Failed to flush Firecracker metrics!")
554+
finally:
555+
self._flush_metrics()
549556

550557
def run(self):
551558
self.running = True

0 commit comments

Comments
 (0)