Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ RUN ${DATAFED_DEPENDENCIES_ROOT}/scripts/generate_dependencies_config.sh && \
-DBUILD_PYTHON_CLIENT=False \
-DBUILD_FOXX=False \
-DENABLE_UNIT_TESTS=True \
-DENABLE_INTEGRATION_TESTS=False
-DENABLE_INTEGRATION_TESTS=True
RUN ${DATAFED_DEPENDENCIES_INSTALL_PATH}/bin/cmake --build build -j 8
RUN ${DATAFED_DEPENDENCIES_INSTALL_PATH}/bin/cmake --build build --target install

Expand Down
80 changes: 76 additions & 4 deletions core/server/tests/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,28 @@ set(MOCK_SCHEMA_PORT "4010"
set(MOCK_SCHEMA_PULL "true"
CACHE STRING "Pull the mock image before starting (set to 'false' for offline/local builds)")

set(ARANGO_IMAGE "savannah.ornl.gov/datafed/arango-foxx:latest"
CACHE STRING "Docker image for the ArangoDB test instance (with Foxx services)")
set(ARANGO_PORT "8529"
CACHE STRING "Host port for the ArangoDB test container")
set(ARANGO_ROOT_PASS "test"
CACHE STRING "Root password for the ArangoDB test instance")
set(ARANGO_PULL "true"
CACHE STRING "Pull the ArangoDB image before starting (set to 'false' for offline/local builds)")

# ── Check for Docker (needed by SchemaAPIClient tests) ───────────────────────

find_program(DOCKER_EXECUTABLE docker)
if(NOT DOCKER_EXECUTABLE)
message(STATUS "Docker not found — SchemaAPIClient integration tests will be skipped")
message(STATUS "Docker not found — integration tests requiring containers will be skipped")
endif()

# ── Compile and register all integration tests ──────────────────────────────

foreach(PROG
test_SchemaServiceFactory
test_SchemaAPIClient
test_SchemaHandler
)
file(GLOB ${PROG}_SOURCES ${PROG}*.cpp)
add_executable(integration_${PROG} ${${PROG}_SOURCES})
Expand Down Expand Up @@ -52,14 +62,18 @@ endforeach(PROG)

if(DOCKER_EXECUTABLE)

# ========================================================================
# Mock Schema API (Prism) fixture — used by SchemaAPIClient
# ========================================================================

set(_mock_schema_env
"MOCK_SCHEMA_IMAGE=${MOCK_SCHEMA_IMAGE}"
"MOCK_SCHEMA_PORT=${MOCK_SCHEMA_PORT}"
"MOCK_SCHEMA_PULL=${MOCK_SCHEMA_PULL}"
"CONTAINER_NAME=datafed-mock-schema"
)

set(_test_env
set(_mock_schema_test_env
"SCHEMA_API_TEST_URL=http://localhost:${MOCK_SCHEMA_PORT}"
)

Expand Down Expand Up @@ -91,14 +105,72 @@ if(DOCKER_EXECUTABLE)

set_tests_properties(integration_test_SchemaAPIClient PROPERTIES
FIXTURES_REQUIRED MockSchemaAPI
ENVIRONMENT "${_test_env}"
ENVIRONMENT "${_mock_schema_test_env}"
LABELS "integration"
)

if(ENABLE_MEMORY_TESTS)
set_tests_properties(memory_test_SchemaAPIClient PROPERTIES
FIXTURES_REQUIRED MockSchemaAPI
ENVIRONMENT "${_test_env}"
ENVIRONMENT "${_mock_schema_test_env}"
LABELS "integration;memory"
)
endif()

# ========================================================================
# ArangoDB fixture — used by SchemaHandler
# ========================================================================

set(_arango_env
"ARANGO_IMAGE=${ARANGO_IMAGE}"
"ARANGO_PORT=${ARANGO_PORT}"
"ARANGO_ROOT_PASS=${ARANGO_ROOT_PASS}"
"ARANGO_PULL=${ARANGO_PULL}"
"ARANGO_CONTAINER=datafed-test-arango"
)

set(_arango_test_env
"DATAFED_TEST_ARANGO_URL=http://localhost:${ARANGO_PORT}"
"DATAFED_TEST_ARANGO_USER=root"
"DATAFED_TEST_ARANGO_PASS=${ARANGO_ROOT_PASS}"
)

# ── Fixture setup: start ArangoDB container ──────────────────────────

add_test(
NAME arango_start
COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/start_test_arango.sh
)
set_tests_properties(arango_start PROPERTIES
FIXTURES_SETUP TestArangoDB
ENVIRONMENT "${_arango_env}"
LABELS "fixture;integration"
)

# ── Fixture cleanup: stop and remove container ───────────────────────

add_test(
NAME arango_stop
COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/stop_test_arango.sh
)
set_tests_properties(arango_stop PROPERTIES
FIXTURES_CLEANUP TestArangoDB
ENVIRONMENT "${_arango_env}"
LABELS "fixture;integration"
)

# ── Attach fixture to SchemaHandler tests ────────────────────────────

set_tests_properties(integration_test_SchemaHandler PROPERTIES
FIXTURES_REQUIRED TestArangoDB
ENVIRONMENT "${_arango_test_env}"
LABELS "integration"
)

if(ENABLE_MEMORY_TESTS)
set_tests_properties(memory_test_SchemaHandler PROPERTIES
FIXTURES_REQUIRED TestArangoDB
ENVIRONMENT "${_arango_test_env}"
LABELS "integration;memory"
)
endif()
Expand Down
7 changes: 7 additions & 0 deletions scripts/compose_build_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ if [[ "$BUILD_METADATA" == "TRUE" ]]; then
--build-arg BASE_IMAGE=$BASE_IMAGE \
-t datafed-runtime:latest
fi
docker build -f \
"${PROJECT_ROOT}/core/docker/Dockerfile" \
--build-arg DEPENDENCIES="datafed-dependencies:latest" \
--build-arg RUNTIME="datafed-runtime:latest" \
--target core-build \
"${PROJECT_ROOT}" \
-t datafed-core-build:latest
docker build -f \
"${PROJECT_ROOT}/core/docker/Dockerfile" \
--build-arg DEPENDENCIES="datafed-dependencies:latest" \
Expand Down
2 changes: 1 addition & 1 deletion tests/mock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ foreach(PROG
file(GLOB ${PROG}_SOURCES ${PROG}*.cpp)
add_executable(mock_liveness_${PROG} ${${PROG}_SOURCES})

target_link_libraries(mock_liveness_${PROG} PUBLIC ${DATAFED_BOOST_LIBRARIES} ${DATAFED_GSSAPI_LIBRARIES} ${DATAFED_GLOBUS_COMMON_LIBRARIES} common )
target_link_libraries(mock_liveness_${PROG} PUBLIC ${DATAFED_BOOST_LIBRARIES} common )
if(BUILD_SHARED_LIBS)
target_compile_definitions(mock_liveness_${PROG} PRIVATE BOOST_TEST_DYN_LINK)
endif()
Expand Down
Loading