From c13888180a8ffff70b0fb98b8a5b876bcb23d542 Mon Sep 17 00:00:00 2001 From: Eric Jolibois Date: Wed, 13 Dec 2023 22:58:38 +0100 Subject: [PATCH] docs: improve a bit the onboarding --- .config/nextest.toml | 4 ++-- prqlc/prql-compiler/Cargo.toml | 4 ++-- prqlc/prql-compiler/tests/integration/dbs/README.md | 12 +++++++++--- prqlc/prql-compiler/tests/integration/queries.rs | 1 + 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.config/nextest.toml b/.config/nextest.toml index 2e4b383a9b4b..07c81e8e0913 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -10,8 +10,8 @@ slow-timeout = { period = "2s", terminate-after = 4 } [test-groups.test-dbs] # test-dbs runs database setup when the connection is established, -# and becuase nextest runs test in separate processes, this happens on every test. -# To prevent mutliple setups running at once, we set max-threads to 1. +# and because nextest runs test in separate processes, this happens on every test. +# To prevent multiple setups running at once, we set max-threads to 1. # Ideally, we could run tests in parallel and they would use a locking mechanism to see if # the database has already been setup. For now, we can use cargo test instead. max-threads = 1 diff --git a/prqlc/prql-compiler/Cargo.toml b/prqlc/prql-compiler/Cargo.toml index e8e8ed4946d1..e4e26fe4963e 100644 --- a/prqlc/prql-compiler/Cargo.toml +++ b/prqlc/prql-compiler/Cargo.toml @@ -43,8 +43,8 @@ strum_macros = "0.25.3" serde_yaml = {version = "0.9", optional = true} [target.'cfg(not(target_family="wasm"))'.dependencies] -# For integration tests. These are gated by the `test-dbs` feature, rather than -# dev-dependencies, because dev-dependencies can't be optional. +# For integration tests. These are gated by the `test-dbs` and `test-dbs-external` features, +# rather than dev-dependencies, because dev-dependencies can't be optional. chrono = {version = "0.4", optional = true, features = [], default-features = false} duckdb = {version = "0.9.2", optional = true, features = ["bundled", "chrono"]} glob = {version = "0.3.1", optional = true} diff --git a/prqlc/prql-compiler/tests/integration/dbs/README.md b/prqlc/prql-compiler/tests/integration/dbs/README.md index 337f5255dae0..8a7b3be037e4 100644 --- a/prqlc/prql-compiler/tests/integration/dbs/README.md +++ b/prqlc/prql-compiler/tests/integration/dbs/README.md @@ -13,8 +13,8 @@ cargo test --features=test-dbs ## External DBs -To run tests against external databases — currently Postgres, MySQL, SQL Server -and ClickHouse are tested — we use `docker compose`: +To run tests against external databases — currently Postgres, MySQL, SQL Server, +ClickHouse and GlareDB are tested — we use `docker compose`: 1. Run `docker compose up` (may take a while on the first time): @@ -26,15 +26,21 @@ and ClickHouse are tested — we use `docker compose`: 2. Run the tests: ```sh - cargo test --features=test-dbs-external + cargo test --features=test-dbs-external --no-capture ``` + The `--no-capture` option is definitely not required but is practical to see + all the dialects tested per query. + 3. After you're done, stop the containers and remove local images and volumes: ```sh docker compose down -v --rmi local ``` +Note: if you're on an M1 and your MSSQL docker container doesn't run, refer to +[this comment](https://github.com/microsoft/mssql-docker/issues/668#issuecomment-1436802153) + ## Data Columns are renamed to `snake_case`, so Postgres and DuckDb don't struggle with diff --git a/prqlc/prql-compiler/tests/integration/queries.rs b/prqlc/prql-compiler/tests/integration/queries.rs index 839ce5e6ff97..490bbf511fa8 100644 --- a/prqlc/prql-compiler/tests/integration/queries.rs +++ b/prqlc/prql-compiler/tests/integration/queries.rs @@ -162,6 +162,7 @@ mod results { let dialect = con.cfg.dialect; + println!("Executing {test_name} for {dialect}"); let rows = con .run_query(&prql) .context(format!("Executing {test_name} for {dialect}"))