Skip to content

feat(test): add automated pre-deploy test suite#10

Open
theredspoon wants to merge 1 commit intosimple10:mainfrom
theredspoon:test/test-suite
Open

feat(test): add automated pre-deploy test suite#10
theredspoon wants to merge 1 commit intosimple10:mainfrom
theredspoon:test/test-suite

Conversation

@theredspoon
Copy link
Contributor

Summary

  • Extract 11 pure functions from pre-deploy.mjs into pre-deploy-lib.mjs for unit testability
  • Add 161 tests across 19 test files covering config resolution, template rendering, shell grep patterns, AI Gateway worker routing/auth/admin, and resolve-config-vars coercion
  • Single entry point: npm test runs root vitest (102 tests) + workers/ai-gateway vitest with miniflare KV (59 tests)
  • Catches regressions like the false-positive docker.io grep pattern and MATRIX_ENABLED=false baked-env bug that were found manually in prior deploys

Test plan

  • npm test — all 161 tests pass
  • npm run pre-deploy:dry — lib extraction preserves full build pipeline behavior
  • AI Gateway worker tests run in Cloudflare Workers runtime via @cloudflare/vitest-pool-workers

Extract pure functions from build/pre-deploy.mjs into pre-deploy-lib.mjs
for testability. Add 167 tests across 19 files covering:

- Pre-deploy config resolution (env refs, deep merge, memory parsing,
  claw validation, daily report time, env value formatting, stack env
  generation, auto token resolution, JSONC parsing)
- AI Gateway Worker (routing, auth with KV, CORS, errors, log sanitization,
  llemtry enablement, admin credential masking/merging)
- Docker compose template rendering (Handlebars → valid YAML)
- Shell grep patterns from build-openclaw.sh against fixture files
- resolve-config-vars.mjs subprocess tests

Entry point: npm test (runs vitest at root + workers/ai-gateway)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant