Skip to content

Commit

Permalink
Skip MinIO test when the MinIO playground is not responding or filled…
Browse files Browse the repository at this point in the history
… up (#1068)

The MinIO tests often fails due to the MinIO playground not being available or its storage is filled up by other users.
Instead of failing the whole DLite test suite, it is highly preferable to just mark the MinIO tests as skipped in these cases.

Tried to implement this PR at the CMake level to avoid unnecessary complicating the minio_storage example. However, CMake unfortunately doesn't support combining the TIMEOUT and SKIP_REGULAR_EXPRESSION test properties (as also noted by https://stackoverflow.com/questions/49153984/non-failing-timeout-using-ctest), so timeout was moved to Python.

We currently have not timeout in the test_minio cmake test since dlite.Storage doesn't implement timeout. Issue #1067 has been added to address that.

Also bumped up the CMake requirements to 3.16 such that we can use the SKIP_REGULAR_EXPRESSION test property.
  • Loading branch information
jesper-friis authored Jan 20, 2025
1 parent 990b0df commit bc1bda7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- Mode: cmake -*-
#
cmake_minimum_required(VERSION 3.14)
cmake_minimum_required(VERSION 3.16)

project(dlite
VERSION 0.5.26
Expand Down
13 changes: 13 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,22 @@ 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()





install(
DIRECTORY ex1 ex2 ex3 ex4 ex5d read-csv dehydrogenation
DESTINATION share/dlite/examples
Expand Down
9 changes: 7 additions & 2 deletions examples/minio_storage/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
import subprocess
from pathlib import Path
Expand All @@ -10,5 +11,9 @@

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)
6 changes: 6 additions & 0 deletions storages/python/tests-python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 test_minio PROPERTY
SKIP_REGULAR_EXPRESSION "XMinioStorageFull"
)

0 comments on commit bc1bda7

Please sign in to comment.