mirror of
https://github.com/latentPrion/cppbessot.git
synced 2026-06-23 15:18:37 +00:00
Add tests db DB_TARGET for tests
This commit is contained in:
@@ -3,10 +3,12 @@ function(_cppbessot_db_action_test_common_args out_var test_name script_name)
|
||||
"-DCPPBESSOT_TEST_NAME=${test_name}"
|
||||
"-DCPPBESSOT_TEST_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"-DCPPBESSOT_TEST_MODULE_SOURCE_DIR=${PROJECT_SOURCE_DIR}"
|
||||
"-DCPPBESSOT_DB_ACTION_TEST_PGSQL_ADMIN_CONNSTR=${CPPBESSOT_DB_ACTION_TEST_PGSQL_ADMIN_CONNSTR}"
|
||||
"-DCPPBESSOT_DB_PGSQL_DEV_CONNSTR=${CPPBESSOT_DB_PGSQL_DEV_CONNSTR}"
|
||||
"-DCPPBESSOT_DB_PGSQL_PROD_CONNSTR=${CPPBESSOT_DB_PGSQL_PROD_CONNSTR}"
|
||||
"-DCPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR=${CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR}"
|
||||
"-DCPPBESSOT_DB_PGSQL_TESTS_CONNSTR=${CPPBESSOT_DB_PGSQL_TESTS_CONNSTR}"
|
||||
"-DCPPBESSOT_DB_PGSQL_CLONE_PROD_TO_PRODDEV_COMMAND=${CPPBESSOT_DB_PGSQL_CLONE_PROD_TO_PRODDEV_COMMAND}"
|
||||
"-DCPPBESSOT_DB_SQLITE_CLONE_PROD_TO_PRODDEV_COMMAND=${CPPBESSOT_DB_SQLITE_CLONE_PROD_TO_PRODDEV_COMMAND}"
|
||||
"-DCPPBESSOT_DB_ACTION_TEST_SCRIPT=${CMAKE_CURRENT_SOURCE_DIR}/scripts/${script_name}")
|
||||
set(${out_var} "${_args}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -25,8 +27,8 @@ function(cppbessot_add_real_pgsql_db_action_test test_name script_name)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if("${CPPBESSOT_DB_ACTION_TEST_PGSQL_ADMIN_CONNSTR}" STREQUAL "")
|
||||
message(STATUS "Skipping real PostgreSQL db-action test `${test_name}` because CPPBESSOT_DB_ACTION_TEST_PGSQL_ADMIN_CONNSTR is empty.")
|
||||
if("${CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR}" STREQUAL "")
|
||||
message(STATUS "Skipping real PostgreSQL db-action test `${test_name}` because CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR is empty.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
@@ -51,26 +53,27 @@ cppbessot_add_db_action_test(cppbessot_db_action_missing_migrate_with missing_mi
|
||||
cppbessot_add_db_action_test(cppbessot_db_action_missing_migration_dir missing_migration_dir.cmake)
|
||||
cppbessot_add_db_action_test(cppbessot_db_action_proddev_createfrom_illegal proddev_createfrom_illegal.cmake)
|
||||
cppbessot_add_db_action_test(cppbessot_db_action_sqlite_createfrom sqlite_createfrom.cmake)
|
||||
cppbessot_add_db_action_test(cppbessot_db_action_sqlite_tests_createfrom sqlite_tests_createfrom.cmake)
|
||||
cppbessot_add_db_action_test(cppbessot_db_action_sqlite_invalid_sql sqlite_invalid_sql.cmake)
|
||||
cppbessot_add_db_action_test(cppbessot_db_action_sqlite_migrate sqlite_migrate.cmake)
|
||||
cppbessot_add_db_action_test(cppbessot_db_action_sqlite_proddev_stale sqlite_proddev_stale.cmake)
|
||||
cppbessot_add_db_action_test(cppbessot_db_action_sqlite_proddev_clone sqlite_proddev_clone.cmake)
|
||||
cppbessot_add_db_action_test(cppbessot_db_action_pgsql_createfrom_mock pgsql_createfrom_mock.cmake)
|
||||
cppbessot_add_db_action_test(cppbessot_db_action_pgsql_tests_createfrom_mock pgsql_tests_createfrom_mock.cmake)
|
||||
cppbessot_add_db_action_test(cppbessot_db_action_pgsql_migrate_order pgsql_migrate_order.cmake)
|
||||
cppbessot_add_db_action_test(cppbessot_db_action_pgsql_stale_abort pgsql_stale_abort.cmake)
|
||||
cppbessot_add_db_action_test(cppbessot_db_action_backfill_env_no_structural backfill_env_no_structural.cmake)
|
||||
cppbessot_add_real_pgsql_db_action_test(
|
||||
cppbessot_db_action_pgsql_createfrom_real
|
||||
pgsql_createfrom_real.cmake
|
||||
CPPBESSOT_DB_PGSQL_DEV_CONNSTR)
|
||||
CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR)
|
||||
cppbessot_add_real_pgsql_db_action_test(
|
||||
cppbessot_db_action_pgsql_migrate_real
|
||||
pgsql_migrate_real.cmake
|
||||
CPPBESSOT_DB_PGSQL_DEV_CONNSTR)
|
||||
CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR)
|
||||
cppbessot_add_real_pgsql_db_action_test(
|
||||
cppbessot_db_action_pgsql_proddev_clone_real
|
||||
pgsql_proddev_clone_real.cmake
|
||||
CPPBESSOT_DB_PGSQL_PROD_CONNSTR
|
||||
CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR)
|
||||
cppbessot_add_real_pgsql_db_action_test(
|
||||
cppbessot_db_action_pgsql_proddev_stale_real
|
||||
@@ -79,5 +82,5 @@ cppbessot_add_real_pgsql_db_action_test(
|
||||
cppbessot_add_real_pgsql_db_action_test(
|
||||
cppbessot_db_action_pgsql_backfill_real
|
||||
pgsql_backfill_real.cmake
|
||||
CPPBESSOT_DB_PGSQL_DEV_CONNSTR)
|
||||
CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR)
|
||||
cppbessot_add_db_action_test(cppbessot_db_action_regression regression_targets.cmake)
|
||||
|
||||
@@ -162,8 +162,8 @@ endfunction()
|
||||
|
||||
function(cppbessot_test_has_real_pgsql_support out_var)
|
||||
find_program(_psql psql)
|
||||
if(_psql AND DEFINED CPPBESSOT_DB_ACTION_TEST_PGSQL_ADMIN_CONNSTR
|
||||
AND NOT "${CPPBESSOT_DB_ACTION_TEST_PGSQL_ADMIN_CONNSTR}" STREQUAL "")
|
||||
if(_psql AND DEFINED CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR
|
||||
AND NOT "${CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR}" STREQUAL "")
|
||||
set(${out_var} TRUE PARENT_SCOPE)
|
||||
else()
|
||||
set(${out_var} FALSE PARENT_SCOPE)
|
||||
@@ -174,10 +174,16 @@ function(cppbessot_test_require_real_pgsql_support)
|
||||
cppbessot_test_has_real_pgsql_support(_has_support)
|
||||
if(NOT _has_support)
|
||||
message(FATAL_ERROR
|
||||
"Real PostgreSQL db-action test support requires `psql` and CPPBESSOT_DB_ACTION_TEST_PGSQL_ADMIN_CONNSTR.")
|
||||
"Real PostgreSQL db-action test support requires `psql` and CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR.")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(cppbessot_test_pgsql_admin_connstr out_var)
|
||||
cppbessot_test_require_var(CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR)
|
||||
cppbessot_test_pgsql_connstr_replace_dbname(_admin_connstr "${CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR}" "postgres")
|
||||
set(${out_var} "${_admin_connstr}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(cppbessot_test_pgsql_exec connstr sql_text)
|
||||
find_program(_psql psql REQUIRED)
|
||||
execute_process(
|
||||
@@ -270,23 +276,25 @@ endfunction()
|
||||
|
||||
function(cppbessot_test_pgsql_drop_database connstr)
|
||||
cppbessot_test_require_real_pgsql_support()
|
||||
cppbessot_test_pgsql_admin_connstr(_admin_connstr)
|
||||
cppbessot_test_pgsql_connstr_dbname(_dbname "${connstr}")
|
||||
cppbessot_test_pgsql_escape_identifier(_db_ident "${_dbname}")
|
||||
cppbessot_test_pgsql_escape_literal(_db_lit "${_dbname}")
|
||||
cppbessot_test_pgsql_exec(
|
||||
"${CPPBESSOT_DB_ACTION_TEST_PGSQL_ADMIN_CONNSTR}"
|
||||
"${_admin_connstr}"
|
||||
"SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = ${_db_lit} AND pid <> pg_backend_pid();")
|
||||
cppbessot_test_pgsql_exec(
|
||||
"${CPPBESSOT_DB_ACTION_TEST_PGSQL_ADMIN_CONNSTR}"
|
||||
"${_admin_connstr}"
|
||||
"DROP DATABASE IF EXISTS ${_db_ident};")
|
||||
endfunction()
|
||||
|
||||
function(cppbessot_test_pgsql_create_database connstr)
|
||||
cppbessot_test_require_real_pgsql_support()
|
||||
cppbessot_test_pgsql_admin_connstr(_admin_connstr)
|
||||
cppbessot_test_pgsql_connstr_dbname(_dbname "${connstr}")
|
||||
cppbessot_test_pgsql_escape_identifier(_db_ident "${_dbname}")
|
||||
cppbessot_test_pgsql_exec(
|
||||
"${CPPBESSOT_DB_ACTION_TEST_PGSQL_ADMIN_CONNSTR}"
|
||||
"${_admin_connstr}"
|
||||
"CREATE DATABASE ${_db_ident};")
|
||||
endfunction()
|
||||
|
||||
@@ -297,13 +305,14 @@ endfunction()
|
||||
|
||||
function(cppbessot_test_pgsql_clone_database source_connstr target_connstr)
|
||||
cppbessot_test_require_real_pgsql_support()
|
||||
cppbessot_test_pgsql_admin_connstr(_admin_connstr)
|
||||
cppbessot_test_pgsql_connstr_dbname(_source_db "${source_connstr}")
|
||||
cppbessot_test_pgsql_connstr_dbname(_target_db "${target_connstr}")
|
||||
cppbessot_test_pgsql_escape_identifier(_source_ident "${_source_db}")
|
||||
cppbessot_test_pgsql_escape_identifier(_target_ident "${_target_db}")
|
||||
cppbessot_test_pgsql_drop_database("${target_connstr}")
|
||||
cppbessot_test_pgsql_exec(
|
||||
"${CPPBESSOT_DB_ACTION_TEST_PGSQL_ADMIN_CONNSTR}"
|
||||
"${_admin_connstr}"
|
||||
"CREATE DATABASE ${_target_ident} TEMPLATE ${_source_ident};")
|
||||
endfunction()
|
||||
|
||||
@@ -314,13 +323,14 @@ endfunction()
|
||||
|
||||
function(cppbessot_test_pgsql_clone_command out_var source_connstr target_connstr)
|
||||
cppbessot_test_require_real_pgsql_support()
|
||||
cppbessot_test_pgsql_admin_connstr(_admin_connstr)
|
||||
cppbessot_test_pgsql_connstr_dbname(_source_db "${source_connstr}")
|
||||
cppbessot_test_pgsql_connstr_dbname(_target_db "${target_connstr}")
|
||||
cppbessot_test_pgsql_escape_identifier(_source_ident "${_source_db}")
|
||||
cppbessot_test_pgsql_escape_identifier(_target_ident "${_target_db}")
|
||||
cppbessot_test_pgsql_escape_literal(_source_lit "${_source_db}")
|
||||
cppbessot_test_pgsql_escape_literal(_target_lit "${_target_db}")
|
||||
cppbessot_test_shell_single_quote(_admin_shell "${CPPBESSOT_DB_ACTION_TEST_PGSQL_ADMIN_CONNSTR}")
|
||||
cppbessot_test_shell_single_quote(_admin_shell "${_admin_connstr}")
|
||||
cppbessot_test_shell_single_quote(
|
||||
_term_target_shell
|
||||
"SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = ${_target_lit} AND pid <> pg_backend_pid();")
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../cmake/TestCommon.cmake")
|
||||
|
||||
cppbessot_test_require_real_pgsql_support()
|
||||
cppbessot_test_require_var(CPPBESSOT_DB_PGSQL_DEV_CONNSTR)
|
||||
cppbessot_test_require_var(CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR)
|
||||
cppbessot_test_case_dir(_case_dir)
|
||||
set(_log_file "${_case_dir}/events.log")
|
||||
cppbessot_test_write_file("${_log_file}" "")
|
||||
cppbessot_test_pgsql_isolated_connstr(_dev_connstr "${CPPBESSOT_DB_PGSQL_DEV_CONNSTR}" "dev")
|
||||
cppbessot_test_pgsql_isolated_connstr(_dev_connstr "${CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR}" "dev")
|
||||
|
||||
cppbessot_test_pgsql_reset_database("${_dev_connstr}")
|
||||
cppbessot_test_pgsql_exec(
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../cmake/TestCommon.cmake")
|
||||
|
||||
cppbessot_test_require_real_pgsql_support()
|
||||
cppbessot_test_require_var(CPPBESSOT_DB_PGSQL_DEV_CONNSTR)
|
||||
cppbessot_test_require_var(CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR)
|
||||
cppbessot_test_case_dir(_case_dir)
|
||||
cppbessot_test_pgsql_isolated_connstr(_dev_connstr "${CPPBESSOT_DB_PGSQL_DEV_CONNSTR}" "dev")
|
||||
cppbessot_test_pgsql_isolated_connstr(_dev_connstr "${CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR}" "dev")
|
||||
|
||||
cppbessot_test_pgsql_reset_database("${_dev_connstr}")
|
||||
cppbessot_test_pgsql_exec(
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../cmake/TestCommon.cmake")
|
||||
|
||||
cppbessot_test_require_real_pgsql_support()
|
||||
cppbessot_test_require_var(CPPBESSOT_DB_PGSQL_DEV_CONNSTR)
|
||||
cppbessot_test_require_var(CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR)
|
||||
cppbessot_test_case_dir(_case_dir)
|
||||
cppbessot_test_pgsql_isolated_connstr(_dev_connstr "${CPPBESSOT_DB_PGSQL_DEV_CONNSTR}" "dev")
|
||||
cppbessot_test_pgsql_isolated_connstr(_dev_connstr "${CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR}" "dev")
|
||||
|
||||
cppbessot_test_pgsql_reset_database("${_dev_connstr}")
|
||||
cppbessot_test_pgsql_exec(
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../cmake/TestCommon.cmake")
|
||||
|
||||
cppbessot_test_require_real_pgsql_support()
|
||||
cppbessot_test_require_var(CPPBESSOT_DB_PGSQL_PROD_CONNSTR)
|
||||
cppbessot_test_require_var(CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR)
|
||||
cppbessot_test_case_dir(_case_dir)
|
||||
cppbessot_test_pgsql_isolated_connstr(_prod_connstr "${CPPBESSOT_DB_PGSQL_PROD_CONNSTR}" "prod")
|
||||
cppbessot_test_pgsql_isolated_connstr(_prod_connstr "${CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR}" "prod")
|
||||
cppbessot_test_pgsql_isolated_connstr(_proddev_connstr "${CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR}" "proddev")
|
||||
|
||||
cppbessot_test_pgsql_reset_database("${_prod_connstr}")
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../cmake/TestCommon.cmake")
|
||||
|
||||
cppbessot_test_case_dir(_case_dir)
|
||||
set(_tool_dir "${_case_dir}/tools")
|
||||
set(_log_file "${_case_dir}/psql.log")
|
||||
set(CPPBESSOT_TEST_LOG "${_log_file}")
|
||||
cppbessot_test_write_file("${_log_file}" "")
|
||||
cppbessot_test_write_mock_psql("${_tool_dir}/psql")
|
||||
cppbessot_test_set_path_with_tool_dir("${_tool_dir}")
|
||||
set(ENV{CPPBESSOT_TEST_LOG} "${_log_file}")
|
||||
set(ENV{CPPBESSOT_TEST_PSQL_FAIL_ALL} "0")
|
||||
set(ENV{CPPBESSOT_TEST_PSQL_FAIL_SELECT} "0")
|
||||
|
||||
cppbessot_test_write_project(
|
||||
"${_case_dir}"
|
||||
"set(DB_TARGET \"tests\" CACHE STRING \"\")\n"
|
||||
"set(CPPBESSOT_DB_PGSQL_TESTS_CONNSTR \"dbname=tests_db\" CACHE STRING \"\")\n")
|
||||
cppbessot_test_add_schema("${_case_dir}" "v1.1")
|
||||
cppbessot_test_add_sql_file("${_case_dir}/db/v1.1/generated-sql-ddl/postgre/01-schema.sql"
|
||||
"CREATE TABLE sample(id TEXT PRIMARY KEY);\n")
|
||||
cppbessot_test_add_sql_file("${_case_dir}/db/v1.1/generated-sql-ddl/postgre/02-seed.sql"
|
||||
"INSERT INTO sample(id) VALUES ('row-1');\n")
|
||||
|
||||
cppbessot_test_configure_project("${_case_dir}" "${_case_dir}/build" _cfg_result _cfg_stdout _cfg_stderr)
|
||||
cppbessot_test_assert_success("${_cfg_result}" "${_cfg_stderr}" "fixture configure")
|
||||
cppbessot_test_build_target("${_case_dir}/build" "db_createfrom" _build_result _build_stdout _build_stderr)
|
||||
cppbessot_test_assert_success("${_build_result}" "${_build_stderr}" "db_createfrom pgsql tests mock")
|
||||
|
||||
file(READ "${_log_file}" _log_contents)
|
||||
cppbessot_test_assert_contains("${_log_contents}" "sqlcmd:DROP SCHEMA IF EXISTS public CASCADE; CREATE SCHEMA public;" "pgsql reset log")
|
||||
cppbessot_test_assert_contains("${_log_contents}" "sqlfile:01-schema.sql" "pgsql schema log")
|
||||
cppbessot_test_assert_contains("${_log_contents}" "sqlfile:02-seed.sql" "pgsql seed log")
|
||||
@@ -14,6 +14,15 @@ execute_process(
|
||||
-DDB_SCHEMA_DIR_MIGRATION_FROM=v1.1
|
||||
-DDB_SCHEMA_DIR_MIGRATION_TO=v1.2
|
||||
-DCPPBESSOT_AUTO_ENABLE=ON
|
||||
-DCOURESILIENT_USE_LOCAL_CPPBESSOT_ENV=OFF
|
||||
-DCPPBESSOT_DB_PGSQL_PROD_CONNSTR=
|
||||
-DCPPBESSOT_DB_PGSQL_DEV_CONNSTR=
|
||||
-DCPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR=
|
||||
-DCPPBESSOT_DB_PGSQL_TESTS_CONNSTR=
|
||||
-DCPPBESSOT_DB_SQLITE_PROD_PATH=
|
||||
-DCPPBESSOT_DB_SQLITE_DEV_PATH=
|
||||
-DCPPBESSOT_DB_SQLITE_PRODDEV_PATH=
|
||||
-DCPPBESSOT_DB_SQLITE_TESTS_PATH=
|
||||
RESULT_VARIABLE _cfg_result
|
||||
OUTPUT_VARIABLE _cfg_stdout
|
||||
ERROR_VARIABLE _cfg_stderr
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../cmake/TestCommon.cmake")
|
||||
|
||||
cppbessot_test_case_dir(_case_dir)
|
||||
set(_db_path "${_case_dir}/live/tests.sqlite")
|
||||
cppbessot_test_write_project(
|
||||
"${_case_dir}"
|
||||
"set(DB_TARGET \"tests\" CACHE STRING \"\")\n"
|
||||
"set(CPPBESSOT_DB_SQLITE_TESTS_PATH \"${_db_path}\" CACHE STRING \"\")\n")
|
||||
cppbessot_test_add_schema("${_case_dir}" "v1.1")
|
||||
cppbessot_test_add_sql_file("${_case_dir}/db/v1.1/generated-sql-ddl/sqlite/01-schema.sql"
|
||||
"CREATE TABLE sample(id TEXT PRIMARY KEY, note TEXT);\n")
|
||||
cppbessot_test_add_sql_file("${_case_dir}/db/v1.1/generated-sql-ddl/sqlite/02-seed.sql"
|
||||
"INSERT INTO sample(id, note) VALUES ('seed-1', 'created-second');\n")
|
||||
cppbessot_test_sqlite_exec("${_db_path}"
|
||||
"CREATE TABLE old_data(id TEXT); INSERT INTO old_data(id) VALUES ('legacy');")
|
||||
|
||||
cppbessot_test_configure_project("${_case_dir}" "${_case_dir}/build" _cfg_result _cfg_stdout _cfg_stderr)
|
||||
cppbessot_test_assert_success("${_cfg_result}" "${_cfg_stderr}" "fixture configure")
|
||||
cppbessot_test_build_target("${_case_dir}/build" "db_createfrom" _build_result _build_stdout _build_stderr)
|
||||
cppbessot_test_assert_success("${_build_result}" "${_build_stderr}" "db_createfrom sqlite tests")
|
||||
|
||||
cppbessot_test_sqlite_query_scalar(_row_count "${_db_path}" "SELECT COUNT(*) FROM sample;")
|
||||
if(NOT "${_row_count}" STREQUAL "1")
|
||||
message(FATAL_ERROR "Expected seeded sample row after recreate, got `${_row_count}`.")
|
||||
endif()
|
||||
cppbessot_test_sqlite_query_scalar(_old_table_count "${_db_path}"
|
||||
"SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='old_data';")
|
||||
if(NOT "${_old_table_count}" STREQUAL "0")
|
||||
message(FATAL_ERROR "Expected old_data table to be removed during recreate.")
|
||||
endif()
|
||||
@@ -40,13 +40,13 @@ endfunction()
|
||||
cppbessot_add_odb_orm_test(
|
||||
"sqlite"
|
||||
"sqlite"
|
||||
CPPBESSOT_ODB_TEST_SQLITE_CONNSTR
|
||||
CPPBESSOT_DB_SQLITE_PRODDEV_PATH
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/sqlite_orm_test.cpp"
|
||||
cppbessot::odb_sqlite)
|
||||
|
||||
cppbessot_add_odb_orm_test(
|
||||
"pgsql"
|
||||
"pgsql"
|
||||
CPPBESSOT_ODB_TEST_PGSQL_CONNSTR
|
||||
CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/pgsql_orm_test.cpp"
|
||||
cppbessot::odb_pgsql)
|
||||
|
||||
@@ -54,8 +54,8 @@ void apply_pgsql_ddl(const std::string& connstr)
|
||||
TEST(PgsqlOdbOrm, PersistsLoadsQueriesAndErases)
|
||||
{
|
||||
const std::string connstr = cppbessot_env_or_default(
|
||||
"CPPBESSOT_ODB_TEST_PGSQL_CONNSTR",
|
||||
CPPBESSOT_ODB_TEST_PGSQL_CONNSTR_DEFAULT);
|
||||
"CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR",
|
||||
CPPBESSOT_DB_PGSQL_PRODDEV_CONNSTR_DEFAULT);
|
||||
apply_pgsql_ddl(connstr);
|
||||
odb::pgsql::database db(connstr);
|
||||
cppbessot_run_agent_orm_roundtrip<odb::pgsql::database, odb::pgsql::transaction>(db);
|
||||
|
||||
@@ -43,8 +43,8 @@ void apply_sqlite_ddl(const std::string& connstr)
|
||||
TEST(SqliteOdbOrm, PersistsLoadsQueriesAndErases)
|
||||
{
|
||||
const std::string connstr = cppbessot_env_or_default(
|
||||
"CPPBESSOT_ODB_TEST_SQLITE_CONNSTR",
|
||||
CPPBESSOT_ODB_TEST_SQLITE_CONNSTR_DEFAULT);
|
||||
"CPPBESSOT_DB_SQLITE_PRODDEV_PATH",
|
||||
CPPBESSOT_DB_SQLITE_PRODDEV_PATH_DEFAULT);
|
||||
std::filesystem::remove(connstr);
|
||||
apply_sqlite_ddl(connstr);
|
||||
odb::sqlite::database db(connstr, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);
|
||||
|
||||
Reference in New Issue
Block a user