influxdb/query_tests
Andrew Lamb 73bed810da
chore: Update arrow, arrow-flight, parquet, tonic, prost, etc (#4357)
* chore: Update datafusion

* chore: Update arrow/arrow-flight/parquet to 12

* chore: update datafusion correctly

* chore: Update prost, tonic, and dependents

* fix: Fixup some api changes

* fix: Update test output in db

* fix: Update test output in parquet_file

* fix: remove old pbjson types

* fix: Add "--experimental_allow_proto3_optional" flag

* chore: Run cargo hakari tasks

* fix: compile error

* chore: Update heappy

Co-authored-by: CircleCI[bot] <circleci@influxdata.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-04-20 11:12:17 +00:00
..
cases feat: query log system table for querier (#4157) 2022-03-30 15:38:11 +00:00
generate chore: use Rust edition 2021 2021-10-25 10:58:20 +02:00
src feat: Add basic Querier <--> Ingester "Service Configuration" (#4259) 2022-04-11 11:50:22 +00:00
Cargo.toml chore: Update arrow, arrow-flight, parquet, tonic, prost, etc (#4357) 2022-04-20 11:12:17 +00:00
README.md feat: Allow sql test runner to compare sorted output (#3618) 2022-02-02 19:59:52 +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. 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;