C.W.K.
Stream
Lesson 11 of 13 · published

Smoke Tests

~10 min · smoke, post-deploy, verification

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

'Deployed' is not 'working'

The job deploy turning green means the code reached the runtime. Whether the runtime works is a separate question. Smoke tests answer it.

What to check

  • Health endpoint/health returns 200 with build SHA matching what you just deployed.
  • One golden user-flow — login, fetch profile, log out. The minimum 'is the app alive' shape.
  • External integrations — DB query, cache hit, third-party API ping.
  • Asset URLs — main page returns HTML containing the expected title and CSS bundle hash.

Where smoke fits

  1. Pre-deploy: smoke staging after the staging deploy job, before the prod deploy starts.
  2. Post-deploy: smoke prod immediately after the prod deploy. If it fails, fire the rollback workflow.

Smoke vs full e2e

Smoke is fast (under 60 seconds) and tests presence-of-life. Full end-to-end is slower (5–30 minutes) and tests behavior under realistic conditions. They serve different roles. Smoke gates the deploy; e2e runs in nightly.

Code

Post-deploy smoke + auto-rollback·yaml
  deploy:
    runs-on: ubuntu-latest
    environment: production
    steps:
      - uses: actions/checkout@v4
      - run: ./deploy.sh

  smoke:
    needs: deploy
    runs-on: ubuntu-latest
    steps:
      - name: Health
        run: |
          for i in 1 2 3 4 5; do
            sha=$(curl -fsS https://api.example.com/health | jq -r .sha)
            if [[ "$sha" == "${GITHUB_SHA::7}" ]]; then
              echo 'OK'; exit 0
            fi
            sleep 10
          done
          exit 1
      - name: Golden flow
        run: ./tests/smoke.sh

  rollback:
    needs: smoke
    if: failure()
    runs-on: ubuntu-latest
    environment: production
    steps:
      - run: ./rollback.sh

External links

Exercise

Add a SHA-aware health endpoint to your service (returns build sha + uptime + db ping). Wire a post-deploy smoke job that polls it for 1 minute. Try a deliberately bad deploy and confirm rollback fires.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.