1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0.
//! **SQL** integration test har**NESS**
//!
//! ## Usage
//!
//! The entrypoint of this crate is [Runner] struct. It runs your test cases and
//! compare the result. There are three things you need to do to complete an
//! integration test:
//! - Prepare the test case (of course!)
//! - Implement [`EnvController`] and [`Database`]. They provide methods to start
//! the server, submit the query and clean up etc.
//! - Format the result. Implement [`Display`] for your query result to make them
//! comparable.
//!
//! And then all you need is to run the runner!
//!
//! ```rust, ignore, no_run
//! async fn run_integration_test() {
//! let runner = Runner::new(root_path, env).await;
//! runner.run().await;
//! }
//! ```
//!
//! [`Display`]: std::fmt::Display
//!
//! ## Directory organization
//!
//! An example directory tree is:
//!
//! ```plaintext
//! sqlness
//! ├── local
//! │ ├── config.toml
//! │ ├── dml
//! │ │ └── basic.sql
//! │ ├── ddl
//! │ └── system
//! └── remote
//! ├── config.toml
//! ├── dml
//! ├── ddl
//! └── system
//! ```
//!
//! Here the root dir is `sqlness`, it contains two sub-directories for different
//! "environments": `local` and `remote`. Each environment has an env-specific
//! configuration `config.toml`. All the test cases are placed under corresponding
//! environment directory.
//!
//! Note that only the first layer of sub-directory is special (for distinguash
//! different environments). All deeper layers are treated as the same. E.g.,
//! both `sqlness/local/dml/basic.sql` and `sqlness/local/dml/another-dir/basic.sql`
//! will be run under the `local` in the same pass.
pub use ;
pub use Database;
pub use EnvController;
pub use SqlnessError;
pub use Runner;