Skip to content

CeresDB/sqlness

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

sqlness

Crates.io docs.rs License CI OpenIssue

SQL integration test harNESS

An ergonomic, opinionated framework for SQL integration test.

Example

See basic.rs to learn how to setup a basic test. This is the directory structure of examples

$ tree examples/
examples/
├── basic-case               # Testcase root directory
│   └── simple               # One environment
│       ├── config.toml      # Config file for current environment
│       ├── select.result    # Expected result file
│       └── select.sql       # Input SQL testcase
├── basic.rs                 # Entrypoint of this example

When run it via

cargo run --example basic

It will do following things:

  1. Collect all environments(first-level directory) under basic-case.
  2. Run testcases(.sql files) under environment one after one.
    1. Write temporary result to {testcase}.output
    2. Compare {testcase}.output with {testcase}.result using diff
  3. Report result.

Our target is to keep *.result file up to date, when *.output is equals to its corresponding result, the runner will delete it after executed.

When there is any diffs, the runner will keep *.output for later investigation.

Below is the output of this example:

Run testcase...
Start, env:simple, config:Some("examples/basic-case/simple/config.toml").
Test case "examples/basic-case/simple/select" finished, cost: 0ms
Environment simple run finished, cost:1ms
Stop, env:simple.
MyDB stopped.

Who is using

  • CeresDB, a high-performance, distributed, cloud native time-series database that can handle both time-series and analytics workloads.
  • GreptimeDB, an open-source, cloud-native, distributed time-series database.

If you’re using sqlness and like to be added to this list, welcome to open a PR.

License

This project is under Apache License 2.0.