2026-10-18 12:09:54 +02:00
|
|
|
add_executable(IntegrationTests
|
|
|
|
|
main.cpp
|
|
|
|
|
tst_Smoke.cpp
|
2026-10-18 12:32:16 +02:00
|
|
|
tst_CatalogLoad.cpp
|
|
|
|
|
tst_DatabaseSizes.cpp
|
2026-10-18 17:40:59 +02:00
|
|
|
tst_DataGridMapping.cpp
|
|
|
|
|
tst_DataGridUpdate.cpp
|
|
|
|
|
${CMAKE_SOURCE_DIR}/pglab/crud/CrudModel.cpp
|
|
|
|
|
${CMAKE_SOURCE_DIR}/pglab/crud/DataGridWidget.cpp
|
|
|
|
|
${CMAKE_SOURCE_DIR}/pglab/OpenDatabase.cpp
|
|
|
|
|
${CMAKE_SOURCE_DIR}/pglab/util/PgLabItemDelegate.cpp
|
|
|
|
|
${CMAKE_SOURCE_DIR}/pglab/util/Colors.cpp
|
|
|
|
|
${CMAKE_SOURCE_DIR}/pglab/ResultTableModelUtil.cpp
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
target_include_directories(IntegrationTests PRIVATE
|
|
|
|
|
${CMAKE_SOURCE_DIR}/pglab
|
|
|
|
|
${CMAKE_SOURCE_DIR}/pglab/crud
|
2026-10-18 12:09:54 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
target_link_libraries(IntegrationTests PRIVATE
|
|
|
|
|
pgintegration
|
2026-10-18 12:32:16 +02:00
|
|
|
pglablib
|
2026-10-18 12:09:54 +02:00
|
|
|
GTest::gtest
|
|
|
|
|
Qt6::Core
|
2026-10-18 17:40:59 +02:00
|
|
|
Qt6::Gui
|
|
|
|
|
Qt6::Widgets
|
|
|
|
|
Qt6::Sql
|
|
|
|
|
Qt6::Concurrent
|
2026-10-18 12:09:54 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
target_compile_definitions(IntegrationTests PRIVATE
|
|
|
|
|
PGTEST_FIXTURE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/fixtures"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
set_target_properties(IntegrationTests PROPERTIES
|
|
|
|
|
CXX_STANDARD 20
|
|
|
|
|
CXX_STANDARD_REQUIRED ON
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
option(PGLAB_INTEGRATION_TESTS "Register Docker based PostgreSQL integration tests" OFF)
|
|
|
|
|
|
|
|
|
|
if (PGLAB_INTEGRATION_TESTS)
|
|
|
|
|
set(PGTEST_COMPOSE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/docker-compose.yml)
|
|
|
|
|
|
|
|
|
|
add_test(NAME db_up
|
|
|
|
|
COMMAND docker compose -f ${PGTEST_COMPOSE_FILE} up -d --wait)
|
|
|
|
|
add_test(NAME db_down
|
|
|
|
|
COMMAND docker compose -f ${PGTEST_COMPOSE_FILE} down -v)
|
|
|
|
|
set_tests_properties(db_up PROPERTIES FIXTURES_SETUP pgcluster LABELS integration)
|
|
|
|
|
set_tests_properties(db_down PROPERTIES FIXTURES_CLEANUP pgcluster LABELS integration)
|
|
|
|
|
|
2026-10-18 12:46:38 +02:00
|
|
|
foreach (v 14 15 16 17 18)
|
2026-10-18 12:09:54 +02:00
|
|
|
add_test(NAME integration_pg${v} COMMAND IntegrationTests)
|
|
|
|
|
set_tests_properties(integration_pg${v} PROPERTIES
|
|
|
|
|
FIXTURES_REQUIRED pgcluster
|
|
|
|
|
LABELS integration
|
|
|
|
|
ENVIRONMENT "TEST_DATABASE_URL=postgresql://postgres:test@localhost:543${v}/postgres")
|
|
|
|
|
endforeach ()
|
|
|
|
|
else ()
|
|
|
|
|
add_test(NAME IntegrationTests COMMAND IntegrationTests)
|
|
|
|
|
set_tests_properties(IntegrationTests PROPERTIES LABELS integration)
|
|
|
|
|
endif ()
|