Skip to content

Commit

Permalink
release 0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 committed Mar 29, 2024
1 parent 35cd637 commit d95a7fe
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 33 deletions.
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 <[email protected]>",
Expand Down
64 changes: 34 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@

An ergonomic, opinionated framework for SQL integration test.

# Use as library
# Usage

You can use sqlness as library or as command lines tools directly, it support MySQL/PostgreSQL wire protocol.

## Use as library

First add sqlness to your project:

Expand All @@ -22,7 +26,35 @@ Then implement `Database` and `EnvController` trait to setup your tests.

Users can refer [basic.rs](sqlness/examples/basic.rs) for a complete example.

This is the directory structure of examples
## Use as CLI
```bash
$ cargo install sqlness-cli

$ sqlness-cli -h
SQLNESS command line tool

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`

## Testcase structures
This is the directory structure of testcase for [basic-example](sqlness/examples/basic-case):

```
$ tree examples/
Expand Down Expand Up @@ -67,34 +99,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 d95a7fe

Please sign in to comment.