AgentSkillsCN

qstash-test

在正确配置的前提下,对真实的QStash运行qstash-stress测试套件。 当用户提出以下需求时使用此功能:(1) 运行QStash测试;(2) 对真实QStash进行测试;(3) 运行特定的测试套件;(4) 以--serve模式运行测试;(5) 生成测试报告;(6) 按标签筛选测试。 可通过“运行测试”“测试QStash”“运行基础套件”“以serve模式测试”“运行测试套件”等指令触发。

SKILL.md
--- frontmatter
name: qstash-test
description: |
  Run qstash-stress test suites against real QStash with proper setup.
  Use when user asks to: (1) run QStash tests, (2) test against real QStash, (3) run a specific test suite,
  (4) run tests with --serve mode, (5) generate test reports, (6) filter tests by tags.
  Triggers: "run tests", "test qstash", "run basic suite", "test with serve", "run test-suites".

qstash-test

Run qstash-stress YAML test suites against real QStash.

Prerequisites

  1. Build the CLI:

    bash
    go build -o qstash-stress .
    
  2. Set environment variables:

    bash
    export QSTASH_TOKEN="your-token"
    export QSTASH_CURRENT_SIGNING_KEY="sig_..."
    export QSTASH_NEXT_SIGNING_KEY="sig_..."
    
  3. Start ngrok tunnel:

    bash
    ngrok http 8080
    # Copy the https URL
    export RECEIVER_BASE_URL="https://xxx.ngrok.io"
    

Run Tests

Basic Usage (Recommended)

Run with --serve to start receiver in same process:

bash
./qstash-stress run test-suites/basic.yaml --serve --port 8080

Run Specific Suite

bash
./qstash-stress run test-suites/retry.yaml --serve --port 8080
./qstash-stress run test-suites/queue.yaml --serve --port 8080
./qstash-stress run test-suites/callback.yaml --serve --port 8080

Run Multiple Suites

bash
./qstash-stress run test-suites/*.yaml --serve --port 8080

Filter by Tags

bash
# Only run tests tagged "basic"
./qstash-stress run test-suites/*.yaml --tags basic --serve

# Exclude tests tagged "slow"
./qstash-stress run test-suites/*.yaml --exclude-tags slow --serve

Generate Reports

bash
# Markdown report
./qstash-stress run test-suites/basic.yaml --serve --format markdown -o report.md

# JSON report
./qstash-stress run test-suites/basic.yaml --serve --format json -o report.json

Available Test Suites

SuiteTestsRunnableWhat It Tests
basic.yaml99HTTP methods, payloads, headers
timing.yaml44Delays, scheduled delivery
dedup.yaml44ID and content-based deduplication
retry.yaml87Retry count, delays, Retry-After
callback.yaml52Success/failure callbacks
queue.yaml86FIFO ordering, parallelism
urlgroup.yaml41URL group fanout
batch.yaml42Batch publishing
dlq.yaml42Dead letter queue
edge-cases.yaml43Large payloads

Skipped suites (require multi-step workflow):

  • schedule.yaml (9 tests) - Cron scheduling
  • flowcontrol.yaml (6 tests) - Rate limiting

Troubleshooting

Tests timeout:

  • Ensure --serve flag is used
  • Check ngrok tunnel is active
  • Verify RECEIVER_BASE_URL matches ngrok URL

Signature verification failed:

  • Check signing keys match QStash console
  • Both current and next keys required

Message not delivered:

  • Check QStash console for message status
  • Run with verbose logging: ./qstash-stress -v run ...

Load Testing

For sustained load tests:

bash
./qstash-stress load \
  --profile constant \
  --rate 10 \
  --duration 5m \
  --destination "${RECEIVER_BASE_URL}/message"

Profiles: constant, ramping, burst, spike, soak