From 2f131c644db4ac3935ede1300e815ae11c61fadb Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Thu, 16 Jan 2025 13:25:53 +0100 Subject: [PATCH 1/4] The minio tests often fails due to the minio playground not being available or its storage is filled up by other users. Skip the minio tests in these cases instead of failing the whole dlite test suite. Bumped up the CMake requirements to 3.16 such that we can use the SKIP_REGULAR_EXPRESSION test property. --- CMakeLists.txt | 2 +- examples/CMakeLists.txt | 11 +++++++++++ examples/minio_storage/main.py | 10 ++++++++-- storages/python/tests-python/CMakeLists.txt | 6 ++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 359ad0b03..ad94eb15f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # -*- Mode: cmake -*- # -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(dlite VERSION 0.5.26 diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index e032d4ddc..30557c297 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -117,6 +117,17 @@ if(FORCE_EXAMPLES OR EXISTS ${CMAKE_INSTALL_PREFIX}/share/dlite/examples) endif() +# Special properties on minio_storage for not hanging when the MinIO +# playground is not responding or when the storage is full +set_property(TEST minio_storage APPEND PROPERTY + ENVIRONMENT "TIMEOUT=5" +) +set_property(TEST minio_storage PROPERTY + SKIP_REGULAR_EXPRESSION "(XMinioStorageFull)|(subprocess.TimeoutExpired)" +) + + + install( DIRECTORY ex1 ex2 ex3 ex4 ex5d read-csv dehydrogenation DESTINATION share/dlite/examples diff --git a/examples/minio_storage/main.py b/examples/minio_storage/main.py index 3268e5ce9..40dc60362 100644 --- a/examples/minio_storage/main.py +++ b/examples/minio_storage/main.py @@ -1,3 +1,4 @@ +import os import sys import subprocess from pathlib import Path @@ -10,5 +11,10 @@ thisdir = Path(__file__).resolve().parent -subprocess.check_call(args=[sys.executable, f"{thisdir}/store.py"]) -subprocess.check_call(args=[sys.executable, f"{thisdir}/fetch.py"]) +# Get timeout from the environment +timeout_str = os.getenv("TIMEOUT", None) +timeout = float(timeout_str) if timeout_str else None + +subprocess.check_call([sys.executable, f"{thisdir}/store.py"], timeout=timeout) +subprocess.check_call([sys.executable, f"{thisdir}/fetch.py"], timeout=timeout) +print(f"=== timeout={timeout} ===") diff --git a/storages/python/tests-python/CMakeLists.txt b/storages/python/tests-python/CMakeLists.txt index 862cfff8d..49e00ab9f 100644 --- a/storages/python/tests-python/CMakeLists.txt +++ b/storages/python/tests-python/CMakeLists.txt @@ -85,3 +85,9 @@ foreach(test ${python-tests}) set_property(TEST ${test} PROPERTY SKIP_RETURN_CODE 44) endforeach() + + +# Skip minio test if the minio playground storage is full +set_property(TEST minio_storage PROPERTY + SKIP_REGULAR_EXPRESSION "XMinioStorageFull" +) From 6f46457e0645a09b4dd7065ebaa225bf4bb19dfe Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Thu, 16 Jan 2025 13:46:01 +0100 Subject: [PATCH 2/4] Fixed typo --- storages/python/tests-python/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storages/python/tests-python/CMakeLists.txt b/storages/python/tests-python/CMakeLists.txt index 49e00ab9f..01b00d3a8 100644 --- a/storages/python/tests-python/CMakeLists.txt +++ b/storages/python/tests-python/CMakeLists.txt @@ -88,6 +88,6 @@ endforeach() # Skip minio test if the minio playground storage is full -set_property(TEST minio_storage PROPERTY +set_property(TEST test_minio PROPERTY SKIP_REGULAR_EXPRESSION "XMinioStorageFull" ) From 01af4bed58d7b58f1bd05f9576c5aa12d9f497a5 Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Thu, 16 Jan 2025 13:52:54 +0100 Subject: [PATCH 3/4] Only add additional properties to minio_storage test if it is included --- examples/CMakeLists.txt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 30557c297..b030d41e6 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -114,17 +114,19 @@ if(FORCE_EXAMPLES OR EXISTS ${CMAKE_INSTALL_PREFIX}/share/dlite/examples) SKIP_RETURN_CODE 44) endforeach() + + # Special properties on minio_storage for not hanging when the MinIO + # playground is not responding or when the storage is full + set_property(TEST minio_storage APPEND PROPERTY + ENVIRONMENT "TIMEOUT=5" + ) + set_property(TEST minio_storage PROPERTY + SKIP_REGULAR_EXPRESSION "(XMinioStorageFull)|(subprocess.TimeoutExpired)" + ) + endif() -# Special properties on minio_storage for not hanging when the MinIO -# playground is not responding or when the storage is full -set_property(TEST minio_storage APPEND PROPERTY - ENVIRONMENT "TIMEOUT=5" -) -set_property(TEST minio_storage PROPERTY - SKIP_REGULAR_EXPRESSION "(XMinioStorageFull)|(subprocess.TimeoutExpired)" -) From a94b4690f4e746c77a647eab14d9f6e2c6d6f7d6 Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Thu, 16 Jan 2025 13:59:12 +0100 Subject: [PATCH 4/4] Removed print statement --- examples/minio_storage/main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/minio_storage/main.py b/examples/minio_storage/main.py index 40dc60362..06bace36d 100644 --- a/examples/minio_storage/main.py +++ b/examples/minio_storage/main.py @@ -17,4 +17,3 @@ subprocess.check_call([sys.executable, f"{thisdir}/store.py"], timeout=timeout) subprocess.check_call([sys.executable, f"{thisdir}/fetch.py"], timeout=timeout) -print(f"=== timeout={timeout} ===")