influxdb/query_tests
dependabot[bot] 76f7043417
chore(deps): Bump once_cell from 1.11.0 to 1.12.0 (#4666)
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.11.0 to 1.12.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.11.0...v1.12.0)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-24 08:14:03 +00:00
..
cases test: add query test scenario w/ missing columns in different chunks (#4656) 2022-05-23 12:13:41 +00:00
generate fix: Remove db crate from query_tests 2022-05-06 11:30:36 -04:00
src test: add query test scenario w/ missing columns in different chunks (#4656) 2022-05-23 12:13:41 +00:00
Cargo.toml chore(deps): Bump once_cell from 1.11.0 to 1.12.0 (#4666) 2022-05-24 08:14:03 +00:00
README.md fix: Remove db crate from query_tests 2022-05-06 11:30:36 -04:00

README.md

This crate contains "integration" tests for the query engine. Specifically, it runs queries against a fully created database instance, records the output, and compares it to expected output.

Some tests simply have their inputs and outputs hard coded into #[test] annotated tests as is Rust's norm.

The tests in src/runner are driven somewhat more dynamically based on input files.

Cookbook: Adding a new Test

How to make a new test:

  1. Add a new file .sql to the cases/in directory
  2. Regenerate file: (cd generate && cargo run)
  3. Run the tests `` cargo test -p query_tests`
  4. You will get a failure message that contains examples of how to update the files

Example output

Possibly helpful commands:
  # See diff
  diff -du "/Users/alamb/Software/influxdb_iox/query_tests/cases/in/pushdown.expected" "/Users/alamb/Software/influxdb_iox/query_tests/cases/out/pushdown.out"
  # Update expected
  cp -f "/Users/alamb/Software/influxdb_iox/query_tests/cases/in/pushdown.out" "/Users/alamb/Software/influxdb_iox/query_tests/cases/out/pushdown.expected"

Cookbook: Adding a new test scenario

Each test can be defined in terms of a "setup" (a set of actions taken to prepare the state of database).

In the future, we envision more fine grained control of these setups (by implementing some of the database commands as IOX_TEST commands), but for now they are hard coded.

The SQL files refer to the setups with a specially formatted comment:

-- IOX_SETUP: OneMeasurementFourChunksWithDuplicates

To add a new setup, follow the pattern in scenario.rs of get_all_setups.