Skip to content

Commit

Permalink
chore: release 0.6.0 (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 authored Mar 29, 2024
1 parent 35cd637 commit e4c602e
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 49 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ceresdbservice@gmail.com>",
Expand Down
66 changes: 34 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,49 @@

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:

```bash
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 <CASE_DIR> --ip <IP> --port <PORT>

Options:
-c, --case-dir <CASE_DIR> Directory of test cases
-i, --ip <IP> IP of database to test against
-p, --port <PORT> Port of database to test against
-u, --user <USER> User of database to test against
-P, --password <PASSWORD> Password of database to test against
-d, --db <DB> DB name of database to test against
-t, --type <DB_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/
Expand Down Expand Up @@ -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 <CASE_DIR> --ip <IP> --port <PORT>

Options:
-c, --case-dir <CASE_DIR> Directory of test cases
-i, --ip <IP> IP of database to test against
-p, --port <PORT> Port of database to test against
-u, --user <USER> User of database to test against
-P, --password <PASSWORD> Password of database to test against
-d, --db <DB> DB name of database to test against
-t, --type <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.
Expand Down
4 changes: 2 additions & 2 deletions sqlness-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 }
Expand All @@ -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"] }

0 comments on commit e4c602e

Please sign in to comment.