influxdb/query_tests/src
Carol (Nichols || Goulding) 1a899b939e
fix: Remove redundant closures identified by clippy
https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
2021-12-02 11:52:02 -05:00
..
influxrpc refactor: remove write buffer producer logic from `Db` 2021-11-26 12:02:27 +01:00
runner fix: Address or allow Clippy warnings new with Rust 1.54 2021-07-30 09:59:59 -04:00
scenarios refactor: remove write buffer producer logic from `Db` 2021-11-26 12:02:27 +01:00
README.md feat: remove move lifecycle action (#2674) 2021-09-30 16:58:05 +00:00
cancellation.rs refactor: remove write buffer producer logic from `Db` 2021-11-26 12:02:27 +01:00
cases.rs chore: merge main to branch 2021-10-12 15:59:57 -04:00
influxrpc.rs refactor: Move `query_tests` and `server_benchmarks` into their own crate --> smaller `server` (#1628) 2021-06-04 17:31:19 +00:00
lib.rs test: ensure query cancellation (somewhat) works (#2931) 2021-10-21 19:10:58 +00:00
pruning.rs refactor: remove write buffer producer logic from `Db` 2021-11-26 12:02:27 +01:00
runner.rs refactor: move delete tests to .sql 2021-10-12 15:49:23 -04:00
scenarios.rs fix: Remove redundant closures identified by clippy 2021-12-02 11:52:02 -05:00
sql.rs test: add group by tests 2021-11-08 10:46:40 -05:00
table_schema.rs refactor: split out schema crate (#2781) 2021-10-11 09:45:08 +00:00

README.md

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

This crate does not (yet) run queries against a fully functioning server (aka run of influxdb_iox binary) but that may be added at some future time.

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 do you make a new test:

  1. Add a new file .sql to the cases/in directory
  2. Run the tests `` cargo test -p query_tests`
  3. 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;