docs-v2/test
Jason Stirnaman db059f99b0
Strategies to improve query performance: operations, number and size … (#5215)
* Strategies to improve query performance: operations, number and size of parquet files
Fixes #5108

- Add query performance strategies to optimize-queries

* Apply suggestions from code review

* Apply suggestions from code review

* Update content/influxdb/cloud-dedicated/query-data/execute-queries/optimize-queries.md

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

* chore(v3): WIP query perf
Fixes #5108

* chore(v3): WIP: Query performance

* chore(v3): WIP: Explain the EXPLAIN report and indicators of query expense, performance problems.

* WIP: optimize queries - how to read a query plan, operators

* WIP: Read a query plan example 2

* WIP: moved how to read a query plan to its own page.

* WIP(v3): operators

* chore(v3): WIP add query plan info from DataFusion slides and @NGA-TRAN

* chore(v3): WIP read a query plan - explain tree format and reorganize

* WIP: query plan

- Adds Query Plan reference
- Completes Analyze a Query Plan, pending cleanup, continue at :471
- Added image from Nga's blog
- Updates EXPLAIN doc
- TODO: Create public docs for
https://github.com/influxdata/docs.influxdata.io/blob/main/content/operations/specifications/iox_runbooks/slow-queries.md

* chore(spelling): Vale config changes

- Add vale to package.json and use Yarn to manage the binary. You can use `npx vale` to run manually.
- Move InfluxData spelling ignore list into the style.
- Reorganize custom (product) spelling lists to comply with Vale 3.x
- Add InfluxDB v3 terms

* chore(spelling): Vale config changes

- Add vale to package.json and use Yarn to manage the binary. You can use `npx vale` to run manually.
- Move InfluxData spelling ignore list into the style.
- Reorganize custom (product) spelling lists to comply with Vale 3.x
- Add InfluxDB v3 terms

* chore(v3): Reorg of query troubleshooting and optimizing docs

- Adds query-data/troubleshoot-and-optimize
- Splits optimize docs into troubleshoot and optimize docs
- Moves Flight response doc to flight-responses.md

* chore: Fixes broken links, typos, missing content, etc.

- Fixes various errors and style violations reported by Vale.
- Fixes broken links and missing content in glossaries.
- Fixes missing and extraneous whitespace.

* Apply suggestions from code review

* Update content/influxdb/cloud-dedicated/query-data/troubleshoot-and-optimize/analyze-query-plan.md

* chore(clustered): Query plan: Apply review suggestions

Co-Authored-By: Nga Tran <20850014+NGA-TRAN@users.noreply.github.com>

* feature(v3): Analyze a query plan:

- Apply code formatting to plan implementor names
- Simplify some points
- Add links

* add query plan html diagram (#5365)

* Update content/influxdb/cloud-dedicated/query-data/troubleshoot-and-optimize/analyze-query-plan.md

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

* Update content/influxdb/cloud-dedicated/query-data/troubleshoot-and-optimize/optimize-queries.md

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

* Update content/influxdb/cloud-dedicated/query-data/troubleshoot-and-optimize/trace.md

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

* Update content/influxdb/cloud-dedicated/query-data/troubleshoot-and-optimize/trace.md

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

* Update content/influxdb/cloud-dedicated/query-data/troubleshoot-and-optimize/trace.md

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

* Update content/influxdb/cloud-serverless/query-data/troubleshoot-and-optimize/analyze-query-plan.md

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

* fix(v3): finish the EXPLAIN descriptions and examples

* chore(tests): Setup a python venv in test containers

* fix(ci): Vale vocab

* fix(v3): Punctuation typo

* chore(ci): Update README

* fix(v3): Apply review suggestions and capitalization

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

* fix(v3): Add note to optimize page and revise troubleshoot

* fix(v3): optimize-queries link

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Co-authored-by: Nga Tran <20850014+NGA-TRAN@users.noreply.github.com>
Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>
2024-03-15 18:40:38 -05:00
..
.dockerignore chore(qol): Test python and shell code samples. WIP - use for local testing only, not ready for CI. (#5154) 2023-09-26 14:56:21 -05:00
.gitignore 5156 Writes: add v1 to Serverless get-started (#5233) 2023-11-15 14:41:29 -06:00
README.md Strategies to improve query performance: operations, number and size … (#5215) 2024-03-15 18:40:38 -05:00
parse_yaml.sh Fixing typos (#5315) 2024-02-05 09:51:51 -07:00
pytest.ini Optimize writes: Use Telegraf to pre-process data before writing (#5282) 2023-12-22 11:23:49 -06:00
requirements.txt Strategies to improve query performance: operations, number and size … (#5215) 2024-03-15 18:40:38 -05:00
run-tests.sh Strategies to improve query performance: operations, number and size … (#5215) 2024-03-15 18:40:38 -05:00

README.md

Test code blocks in Markdown files.

This project contains the following:

  • test.sh: The primary entrypoint for running tests. Copies Markdown files to a temporary directory shared with the test Docker image and runs the test container.
  • test/run-tests.sh: The Docker image entrypoint. Substitutes placeholders with environment variables in code blocks. Passes test files to test runners (for example, pytest --codeblocks for Python and shell code samples).
  • compose.yaml and Dockerfile: Docker image for the test service that installs test dependencies and passes test files to test runners.

Set configuration values

To set your InfluxDB credentials for testing, create a .env.<product-name> file and add key=value properties--for example, in .env.serverless

INFLUX_HOST=https://us-east-1-1.aws.cloud2.influxdata.com
INFLUX_HOSTNAME=us-east-1-1.aws.cloud2.influxdata.com
INFLUX_TOKEN=5Vz...
INFLUX_ORG=28d...
INFLUX_DATABASE=jason-test-create-bucket
INFLUX_RETENTION_POLICY=test-autogen

Storing configuration properties in a .env (dotenv) file is generally preferable to using environment variables.

Build the image

  1. Install Docker for your system.

  2. Build the Docker image.

    docker compose build test
    

    After editing configuration or files used by the image, re-run the preceding build command.

Run tests

Test code blocks in Markdown files that have changed relative to your git master branch:

sh test.sh

Test code blocks in files that match a pattern:

sh test.sh ./content/**/*.md

test.sh copies files into ./test/tmp/ for testing and runs the tests in Docker.

Test runners

Experimental--work in progress

pytest-codeblocks extracts code from python and shell Markdown code blocks and executes assertions for the code. If you don't assert a value, --codeblocks considers a non-zero exit code to be a failure. Note: pytest --codeblocks uses Python's subprocess.run() to execute shell code.

To assert (and display) the expected output of your code, follow the code block with the <!--pytest-codeblocks:expected-output--> comment tag, and then the expected output in a code block--for example:

print("Hello, world!")

If successful, the output is the following:

Hello, world!

pytest-codeblocks has features for skipping tests and marking blocks as failed. To learn more, see the pytest-codeblocks README and tests.

Other tools and ideas for testing code blocks

The codedown NPM package extracts code from Markdown code blocks for each language and can pipe the output to a test runner for the language.

pytest and pytest-codeblocks use the Python Assertions module to keep testing overhead low. Node.js also provides an Assertions package.

The runmd NPM package runs javascript code blocks in Markdown and generates a new Markdown file with the code block output inserted.

Troubleshoot

Pytest collected 0 items

Potential reasons:

  • See the test discovery options in pytest.ini.

  • For Python code blocks, use the following delimiter:

    # Codeblocks runs this block.
    

    pytest --codeblocks ignores code blocks that use the following:

    # Codeblocks ignores this block.