Crate sqlness
Expand description
SQL integration test harNESS
§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
EnvControllerandDatabase. They provide methods to start the server, submit the query and clean up etc. - Format the result. Implement
Displayfor your query result to make them comparable.
And then all you need is to run the runner!
async fn run_integration_test() {
let runner = Runner::new(root_path, env).await;
runner.run().await;
}§Directory organization
An example directory tree is:
sqlness
├── local
│ ├── config.toml
│ ├── dml
│ │ └── basic.sql
│ │ └── basic.result
│ ├── ddl
│ └── system
└── remote
├── config.toml
├── dml
├── ddl
└── systemHere 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 env in the same pass.
Modules§
- database_
impl - interceptor
- Query interceptor implementations.
Structs§
- Config
- Configurations of
Runner. - Config
Builder - Builder for
Config. - Database
Config - Config for DatabaseBuilder
- Database
Config Builder - Builder for
DatabaseConfig. - Query
Context - A String-to-String map used as query context.
- Runner
- The entrypoint of this crate.
Enums§
Traits§
- Database
- Query executor.
- EnvController
- Controller of test environments.
Notable traits for Arc<R>
","Arc>":"Notable traits for Arc<R>
","Arc":"Notable traits for Arc<R>
","Arc":"Notable traits for Arc<R>
","Arc":"Notable traits for Arc<R>
","ArrayChunks":"Notable traits for ArrayChunks<I, N>
","Bytes":"Notable traits for Bytes<R>
","Chain::IntoIter>":"Notable traits for Chain<A, B>
","Chain":"Notable traits for Chain<T, U>
","Cloned":"Notable traits for Cloned<I>
type Item = T;","Copied":"Notable traits for Copied<I>
type Item = T;","Cycle":"Notable traits for Cycle<I>
","Enumerate":"Notable traits for Enumerate<I>
","Filter":"Notable traits for Filter<I, P>
","FilterMap":"Notable traits for FilterMap<I, F>
type Item = B;","FlatMap":"Notable traits for FlatMap<I, U, F>
","Flatten":"Notable traits for Flatten<I>
","Fuse":"Notable traits for Fuse<I>
","Inspect":"Notable traits for Inspect<I, F>
","Intersperse":"Notable traits for Intersperse<I>
","IntersperseWith":"Notable traits for IntersperseWith<I, G>
impl<I, G> Iterator for IntersperseWith<I, G>","Lines":"Notable traits for Lines<B>
","Map":"Notable traits for Map<I, F>
type Item = B;","MapWhile":"Notable traits for MapWhile<I, P>
type Item = B;","MapWindows":"Notable traits for MapWindows<I, F, N>
type Item = R;","Peekable":"Notable traits for Peekable<I>
","Rev":"Notable traits for Rev<I>
","Scan":"Notable traits for Scan<I, St, F>
type Item = B;","Skip":"Notable traits for Skip<I>
","SkipWhile":"Notable traits for SkipWhile<I, P>
","Split":"Notable traits for Split<B>
","StepBy":"Notable traits for StepBy<I>
","Take":"Notable traits for Take<T>
","TakeWhile":"Notable traits for TakeWhile<I, P>
","Zip::IntoIter>":"Notable traits for Zip<A, B>
"}
