|
ORE Studio 0.0.4
|
Manages isolated test databases for parallel test execution. More...
#include <test_database_manager.hpp>

Static Public Member Functions | |
| static database::context | make_context () |
| Creates a database context from environment variables. | |
| static database::database_options | make_database_options () |
| Creates database options from environment variables. | |
| static std::string | generate_test_database_name () |
| Generates a unique database name for this test process. | |
| static void | create_test_database (const std::string &db_name) |
| Creates a test database from the oresdb_template. | |
| static void | drop_test_database (const std::string &db_name) |
| Drops the test database. | |
| static void | set_test_database_env (const std::string &db_name) |
| Sets the TEST_ORES_DB_DATABASE environment variable. | |
Manages isolated test databases for parallel test execution.
This class provides utilities for creating and destroying unique test databases for each test process. This allows multiple test processes to run concurrently without interference.
Each test database is created from the oresdb_template database, which must be pre-configured with the full schema.
|
static |
Generates a unique database name for this test process.
The database name is based on the process ID and a random suffix to ensure uniqueness: oresdb_test_{pid}_{random}

|
static |
Creates a test database from the oresdb_template.
This method connects to the postgres database (admin database) and executes CREATE DATABASE with the template parameter.
| db_name | The name of the database to create |
| std::runtime_error | if database creation fails |

|
static |
Drops the test database.
This method connects to the postgres database and executes DROP DATABASE. It terminates any active connections first.
| db_name | The name of the database to drop |

|
static |
Sets the TEST_ORES_DB_DATABASE environment variable.
This ensures that database_fixture and all tests use the isolated test database.
| db_name | The database name to set |
