rules_itest
v0.0.27
published 10 months ago
19 stars
9 forks
2 watchers
MIT License
public
1 assets
648,551 downloads
58 KB
Compatibility level 1
J+XwC0BgjqPKUTBgkizQnm0klKr6O92BnEzwKulU3uQ=
Maintained byDavid Zbarsky
v0.0.27
October 17, 2024
[expand for release notes]

Bazel rules for integration testing and dev environments

This repository provides a Bazel ruleset for running services in a hermetic way. It can be used to provision development environments or to run tests against services.

For example, you may want to run integration tests that depend on services like a database, Redis, etc., or you may want to integration-test first-party binaries.

With this ruleset, each test can declare the services it depends on. The test will then be provisioned with a fresh instance of those services, each verified to have passed health checks before your test code runs.

This ruleset also integrates with ibazel to support incremental hot-reload during development.

Usage

See docs/itest.md for full documentation.

Per-service reload under ibazel works by injecting a cache-busting input, so it is disabled by default to keep tests cacheable. You can enable it setting the --@rules_itest//:enable_per_service_reload flag.

Note

ibazel invokes cquery which does not accept Starlark flags. Thus you will want to configure the flag in .bazelrc and pass it via --config. A common setup looks like this:

.bazelrc

common:enable-reload --@rules_itest//:enable_per_service_reload

ibazel run --config enable-reload //path/to:target

Examples

First-party service examples (Go and Node.js binaries): tests folder.

More third-party examples (MySQL, Redis, DynamoDB): examples folder.