diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d43500..db7cdbc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,12 +29,10 @@ jobs: matrix: rust: [stable] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - - run: | - rustup set auto-self-update disable - rustup toolchain install ${{ matrix.rust }} --profile minimal + - uses: dtolnay/rust-toolchain@stable - name: Cache Rust Dependencies uses: actions/cache@v3 with: @@ -100,12 +98,10 @@ jobs: matrix: rust: [stable] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - - run: | - rustup set auto-self-update disable - rustup toolchain install ${{ matrix.rust }} --profile minimal + - uses: dtolnay/rust-toolchain@stable - name: Cache Rust Dependencies uses: actions/cache@v3 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7aee5bd..4f1db14 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,14 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + uses: dtolnay/rust-toolchain@stable - name: Publish sqlness run: cargo publish || true # Ignore error diff --git a/Cargo.toml b/Cargo.toml index aa1db26..cd1f444 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["sqlness", "sqlness-cli"] resolver = "2" [workspace.package] -version = "0.5.0" +version = "0.6.0" edition = "2021" authors = [ "CeresDB Authors ", diff --git a/README.md b/README.md index 1749f73..9800157 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,11 @@ An ergonomic, opinionated framework for SQL integration test. -# Use as library +# Usage + +SQLNESS can be used as library or as command lines tool directly, it support MySQL/PostgreSQL wire protocol. + +## Use as library First add sqlness to your project: @@ -18,11 +22,37 @@ First add sqlness to your project: cargo add sqlness ``` -Then implement `Database` and `EnvController` trait to setup your tests. +Then implement `Database` and `EnvController` trait to setup your tests. Refer [basic.rs](sqlness/examples/basic.rs) for a complete example. + +## Use as CLI +```bash +$ cargo install sqlness-cli + +$ sqlness-cli -h +SQLNESS command line tool -Users can refer [basic.rs](sqlness/examples/basic.rs) for a complete example. +Usage: sqlness-cli [OPTIONS] --case-dir --ip --port + +Options: + -c, --case-dir Directory of test cases + -i, --ip IP of database to test against + -p, --port Port of database to test against + -u, --user User of database to test against + -P, --password Password of database to test against + -d, --db DB name of database to test against + -t, --type Which DBMS to test against [default: mysql] [possible values: mysql, postgresql] + -h, --help Print help + -V, --version Print version +``` + +One example used in our CI is +```bash +sqlness-cli -c tests -i 127.0.0.1 -p 3306 -u root -P 1a2b3c -d public +``` +It will test against a MySQL server listening on `127.0.0.1:3306` -This is the directory structure of examples +## Testcase structures +This is the directory structure of testcase for [basic-example](sqlness/examples/basic-case): ``` $ tree examples/ @@ -67,34 +97,6 @@ Stop, env:simple. MyDB stopped. ``` -# Use as CLI -If the tested database supports common wire protocol(such as MySQL), users can choose to use `sqlness-cli` to run integration tests without writing any code. -```bash -$ cargo install sqlness-cli - -$ sqlness-cli -h -A cli to run sqlness tests - -Usage: sqlness-cli [OPTIONS] --case-dir --ip --port - -Options: - -c, --case-dir Directory of test cases - -i, --ip IP of database to test against - -p, --port Port of database to test against - -u, --user User of database to test against - -P, --password Password of database to test against - -d, --db DB name of database to test against - -t, --type Which DBMS to test against [default: mysql] [possible values: mysql] - -h, --help Print help - -V, --version Print version -``` - -One example used in our CI is -```bash -sqlness-cli -c tests -i 127.0.0.1 -p 3306 -u root -P 1a2b3c -d public -``` -It will test against a MySQL server listening on `127.0.0.1:3306` - # Who is using - [CeresDB](https://github.com/CeresDB/ceresdb), a high-performance, distributed, cloud native time-series database that can handle both time-series and analytics workloads. diff --git a/sqlness-cli/Cargo.toml b/sqlness-cli/Cargo.toml index b45758d..d4f2d54 100644 --- a/sqlness-cli/Cargo.toml +++ b/sqlness-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sqlness-cli" -description = "Sqlness command line tool" +description = "SQLNESS command line tool" version = { workspace = true } edition = { workspace = true } homepage = { workspace = true } @@ -13,4 +13,4 @@ readme = { workspace = true } async-trait = "0.1.64" clap = { version = "4.1.8", features = ["derive"] } futures = "0.3.26" -sqlness = { path = "../sqlness", version = "0.5", features = ["mysql", "postgres"] } +sqlness = { path = "../sqlness", version = "0.6", features = ["mysql", "postgres"] }