From dc6869f3a44443cbdab50aeed29bd9595baf9aeb Mon Sep 17 00:00:00 2001 From: Patrick Roy Date: Thu, 6 Jul 2023 14:38:34 +0100 Subject: [PATCH] test(block-perf): Do not load baselines into global constant this caused pytest to crash during test collection if running on an unsupported kernel version. Fixes #3726 Signed-off-by: Patrick Roy --- .../performance/test_block_performance.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/integration_tests/performance/test_block_performance.py b/tests/integration_tests/performance/test_block_performance.py index 3b66f4e57b2f..d050a4b12549 100644 --- a/tests/integration_tests/performance/test_block_performance.py +++ b/tests/integration_tests/performance/test_block_performance.py @@ -27,8 +27,7 @@ TEST_ID = "block_performance" kernel_version = get_kernel_version(level=1) CONFIG_NAME_REL = "test_{}_config_{}.json".format(TEST_ID, kernel_version) -CONFIG_NAME_ABS = os.path.join(defs.CFG_LOCATION, CONFIG_NAME_REL) -CONFIG = json.load(open(CONFIG_NAME_ABS, encoding="utf-8")) +CONFIG_NAME_ABS = defs.CFG_LOCATION / CONFIG_NAME_REL FIO = "fio" @@ -298,9 +297,13 @@ def test_block_performance( "bs": fio_block_size, }, ) + + raw_baselines = json.loads(CONFIG_NAME_ABS.read_text("utf-8")) + st_cons = st.consumer.LambdaConsumer( metadata_provider=DictMetadataProvider( - CONFIG["measurements"], BlockBaselinesProvider(env_id, fio_id) + raw_baselines["measurements"], + BlockBaselinesProvider(env_id, fio_id, raw_baselines), ), func=consume_fio_output, func_kwargs={