| Crates.io | clickhouse-testing-macros |
| lib.rs | clickhouse-testing-macros |
| version | 0.1.2 |
| created_at | 2025-09-02 22:30:37.98774+00 |
| updated_at | 2025-10-16 13:49:25.611962+00 |
| description | A crate that simplifies writing integration tests for ClickHouse, inspired by sqlx. |
| homepage | |
| repository | https://github.com/rdcm/clickhouse-testing |
| max_upload_size | |
| id | 1821738 |
| size | 5,999 |
A crate that simplifies writing integration tests for ClickHouse, inspired by sqlx.
Add the following environment variables to a .env file:
MIGRATIONS_DIR=".migrations"
CLICKHOUSE_URL="http://localhost:8123"
CLICKHOUSE_DB="db"
CLICKHOUSE_USER="user"
CLICKHOUSE_PASSWORD="password"
Write a test:
#[clickhouse_testing::test]
async fn test1(client: clickhouse_testing::Client) {
let version = client
.query("SELECT version()")
.fetch_one::<String>()
.await
.unwrap();
assert_eq!(version, "25.5.2.47");
}
{module_name} + {test_name} + {run_id}."test_db"."test_db" is deleted. If any error occurs, "test_db" is preserved for investigation.Enjoy!