Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/firecracker
Path: blob/main/tests/integration_tests/performance/utils.py
1958 views
1
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
# SPDX-License-Identifier: Apache-2.0
3
"""Utility abstractions for performance tests."""
4
import json
5
6
7
def handle_failure(file_dumper, fail_err):
8
"""Handle `statistics.core.CoreException` raised during...
9
10
...`statistics.core.Core`s `run_exercise`.
11
12
:param file_dumper - ResultsFileDumper
13
:param fail_err - statistics.CoreException
14
"""
15
dump_test_result(file_dumper, fail_err.result)
16
if fail_err:
17
raise fail_err
18
19
20
def dump_test_result(file_dumper, result):
21
"""Dump tests results to file using the `file_dumper`.
22
23
:param file_dumper - ResultsFileDumper
24
:param result - dict
25
"""
26
if isinstance(result, dict) and file_dumper:
27
file_dumper.writeln(json.dumps(result))
28
29