返回提示词目录第 1160 页

编写部署后冒烟测试并接入流水线

围绕部署后的健康状态、登录及核心交易编写快速检查,接入发布流水线并报告验证结果。

完整提示词

<context>
A smoke suite answers one question within a couple of minutes of a deploy: is this build alive and wired correctly, or should we stop? It is not a regression suite. Good smoke tests check what a deploy can break that unit tests cannot: the service starts and answers, configuration and secrets resolved, the database and key dependencies are reachable, the main page renders with its assets, sign-in works, and the one or two core transactions complete. They must be fast (minutes, not tens of minutes), deterministic (a flaky smoke test gets ignored or causes needless rollbacks), and safe against production: read-only where possible, using dedicated test accounts, and never creating real orders, charges, emails or analytics noise. A health endpoint that returns 200 without checking anything is not a smoke test.
</context>

<task>
Write smoke tests for:
{{system}}

Target environment: {{target_env}}
{{#test_tooling}}
Existing tooling: {{test_tooling}}
{{/test_tooling}}

1. Read the repository: routes, health endpoints, deploy pipeline config, existing end-to-end or API tests and their helpers. Reuse the existing framework and helpers rather than adding a new tool.
2. Pick the paths: version or build-id check (to prove the new build is the one serving), health with real dependency checks, the main page or API root, sign-in with a dedicated smoke account, and at most two or three core transactions. Keep the total under about five minutes.
3. For each write path, make it safe for the target environment: use a smoke-test account or tenant, a sandbox payment method, idempotent or self-cleaning operations, and a marker so analytics and emails can filter it out. If a path cannot be made safe in production, test it read-only or leave it out and say so.
4. Write the tests with explicit, short timeouts and clear failure messages that say which dependency or path failed.
5. Wire them into the pipeline: run right after deploy to the target, block promotion on failure, and either trigger the existing rollback or alert with the failing check. Read credentials from the CI secret store, never from the repository.
6. Run the suite against a non-production environment if one is reachable and report the results and timing. Do not run anything against production without the user's confirmation.
</task>

<constraints>
- No test may create real customer-visible effects in production (charges, emails, messages, public content).
- No secrets, tokens or real user credentials in code or config; reference secret names only.
- No sleeps for synchronisation; wait on conditions with bounded timeouts.
- Keep the suite small; push anything that is regression coverage to the regular suites and say so.
{{> guardrails/verify-before-done}}
</constraints>

<output_format>
## Paths covered
Table: path | why it is a smoke check | read-only or write | expected time.

## Tests
The test files, as diffs or full files.

## Pipeline wiring
The CI change and what happens on failure.

## Safety notes
Accounts, markers and cleanup used, plus paths left out and why.

## Verification
Where it was run, results and total runtime, or what could not be run.
</output_format>

可替换内容

  • {{system}}
  • {{target_env}}
  • {{#test_tooling}}
  • {{test_tooling}}
  • {{/test_tooling}}
  • {{> guardrails/verify-before-done}}

分类与标签

编程开发、冒烟测试、部署验证、发布流水线、健康检查

前往 AI 图片创作