The provider has unit tests and acceptance tests.
- Run:
make test - For general contributor notes, see
contributing.md.
Acceptance tests require a running Elastic Stack and TF_ACC=1.
General workflow (all acceptance coverage, not only the examples harness):
- Prefer targeted runs:
go test -v [-run 'filter'] <package> - When instructed, run the full suite with
make testacc - The Elastic stack may already be running; check before starting a new environment (
curl -u $ELASTICSEARCH_USERNAME:$ELASTICSEARCH_PASSWORD $ELASTICSEARCH_ENDPOINTS) - To start local stack services if needed (set
STACK_VERSIONwhen a specific version is required):make docker-fleet
*.tf files under examples/resources/ and examples/data-sources/ (except harness skip-lists) are planned in isolation by TestAccExamples_planOnly in internal/acctest/. For contributor expectations—self-contained modules, acceptance environment—see the Example snippets section in development-workflow.md.
TF_ACC=1 go test ./internal/acctest -run '^TestAccExamples_planOnly$' -count=1Targeted acceptance test runs commonly require the following environment variables:
ELASTICSEARCH_ENDPOINTS(default:http://localhost:9200)ELASTICSEARCH_USERNAME(default:elastic)ELASTICSEARCH_PASSWORD(default:password)KIBANA_ENDPOINT(default:http://localhost:5601)TF_ACC=1
In a worktrunk-created worktree, .config/wt.toml generates .env with all of the common acceptance variables above except TF_ACC, so after exporting .env you can usually run TF_ACC=1 go test ... directly.
Example targeted run:
ELASTICSEARCH_ENDPOINTS=http://localhost:9200 \
ELASTICSEARCH_USERNAME=elastic \
ELASTICSEARCH_PASSWORD=password \
KIBANA_ENDPOINT=http://localhost:5601 \
TF_ACC=1 \
go test -v -run TestAccResourceName ./path/to/packageSee “Testing” in coding-standards.md.