Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: integration test support env filter #811

Merged
merged 2 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ local-ip-address = "0.5"
reqwest = { workspace = true }
serde = { workspace = true }
sql = { workspace = true }
sqlness = "0.4.0"
sqlness = "0.4.3"
sqlparser = { workspace = true }
tokio = { workspace = true }
6 changes: 6 additions & 0 deletions integration_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Takes 49.020203ms. Diff: false. Test case "/home/ruihang/repo/CeresDB/tests/case
Run 1 finished. 0 cases are different.
```

Users can set `CERESDB_ENV_FILTER` variables to filter env to run. For example:
```
CERESDB_ENV_FILTER=local make run
```
This command will only run cases in `local`.

## Add a test

Please refer README of https://github.com/CeresDB/sqlness
Expand Down
7 changes: 5 additions & 2 deletions integration_tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::database::{CeresDBCluster, CeresDBServer};
mod database;

const CASE_ROOT_PATH_ENV: &str = "CERESDB_TEST_CASE_PATH";
const ENV_FILTER_ENV: &str = "CERESDB_ENV_FILTER";

struct CeresDBController;
struct UntypedCeresDB {
Expand Down Expand Up @@ -62,12 +63,14 @@ impl EnvController for CeresDBController {
#[tokio::main]
async fn main() -> Result<()> {
let case_dir = env::var(CASE_ROOT_PATH_ENV)?;
let env = CeresDBController;
let controller = CeresDBController;
let env_filter = env::var(ENV_FILTER_ENV).unwrap_or_else(|_| ".*".to_string());
let config = sqlness::ConfigBuilder::default()
.case_dir(case_dir)
.env_filter(env_filter)
.follow_links(true)
.build()?;
let runner = Runner::new_with_config(config, env).await?;
let runner = Runner::new_with_config(config, controller).await?;
runner.run().await?;

Ok(())
Expand Down