Development and Testing¶
Environment¶
- Go 1.24 or newer; CI tests Go 1.24.x and stable.
- GNU Make, Git, Docker Buildx, Helm, and golangci-lint for the corresponding gates.
- Optional local
promtoolandkubeconform; CI installs pinned versions.
git clone https://github.com/Sakuya1998/aws-cost-exporter.git
cd aws-cost-exporter
go mod download
make build
Quality gates¶
CI additionally runs formatting/import checks, govulncheck, gosec, coverage at or above 79%, chart/dashboard/rule/docs tests, container smoke, and multi-architecture builds.
v1 adds versioned configuration, metrics, and HTTP contract fixtures, an 85% core-coverage floor, gitleaks, and a deterministic 20-target/20,000-series capacity test. For v1.0.0, the 24-hour stability run, sanitized real AWS least-privilege validation, and v0.3.0 upgrade/rollback exercise were explicitly deferred by the maintainer and are not reported as passed. Future results must be recorded without account IDs, costs, SQL, or credentials.
Testing strategy¶
- Domain tests validate sorting, uniqueness, amount conservation, provider/basis identity, and immutable traversal.
- AWS adapter tests use fake endpoints for pagination, retry, cancellation, malformed results, and sensitive-data redaction.
- Scheduler/cache tests cover single-flight, target isolation, old-data retention, shutdown, and goroutine recovery.
- Golden metrics lock names, types, and fixed label order.
- Integration/E2E tests verify multiple targets, readiness, binary shutdown, and that
/metricsnever calls AWS. - Asset tests validate Helm, kubeconform, dashboard PromQL, rules, IAM, release configuration, and Wiki contracts.
Write a failing test before changing behavior. Keep interfaces narrow and defined in the consuming package. Do not introduce AWS SDK response types into domain packages or arbitrary labels into Prometheus descriptors.
Pull requests¶
Follow CONTRIBUTING.md, keep changes focused, explain operational risk, update docs for public contracts, and sign commits with the Developer Certificate of Origin:
Security reports use the private process in SECURITY.md, not public issues.