This project uses Makefile targets for all test runs. Do not run raw go test directly.
Acceptance tests require sandbox credentials:
DD_TEST_CLIENT_API_KEYDD_TEST_CLIENT_APP_KEY
Optional:
DD_TEST_SITE_URLto override the API site for tests.
Use these Makefile targets to run tests:
make test # Unit tests only
make testacc # Acceptance tests only
make testall # Unit + acceptance testsRun unit tests with:
make testRun acceptance tests with:
make testaccAcceptance tests use cassettes stored under datadog/tests/cassettes/. The RECORD env var controls whether tests hit the live API:
RECORD=false: Replay from cassettes (default, no API calls). Use in CI and to verify cassettes.RECORD=true: Record new cassettes (hits real API). Use after fixing tests.RECORD=none: Live API only (no recording). Use for debugging.
RECORD=none \
DD_TEST_CLIENT_API_KEY=$DD_TEST_CLIENT_API_KEY \
DD_TEST_CLIENT_APP_KEY=$DD_TEST_CLIENT_APP_KEY \
TESTARGS="-run TestAccDatadogMonitor_Basic" \
make testaccUse TESTARGS to pass flags to the underlying test runner. Example:
TESTARGS="-run TestAccDatadogServiceLevelObjective_Basic" make testacc- Never use production credentials; tests create, update, and delete real resources.
- Use
RECORD=falseto verify cassette playback matches CI behavior.