From 1bfb04abb64e2d5152e5b39ce9d4276b650a7861 Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 08:23:27 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 15 ++ README.md | 3 + commands/smoke-test.md | 216 ++++++++++++++++++ plugin.lock.json | 61 +++++ skills/smoke-test-runner/SKILL.md | 52 +++++ skills/smoke-test-runner/assets/README.md | 7 + skills/smoke-test-runner/references/README.md | 7 + skills/smoke-test-runner/scripts/README.md | 7 + 8 files changed, 368 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 commands/smoke-test.md create mode 100644 plugin.lock.json create mode 100644 skills/smoke-test-runner/SKILL.md create mode 100644 skills/smoke-test-runner/assets/README.md create mode 100644 skills/smoke-test-runner/references/README.md create mode 100644 skills/smoke-test-runner/scripts/README.md diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..b464e60 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,15 @@ +{ + "name": "smoke-test-runner", + "description": "Quick smoke test suites to verify critical functionality after deployments", + "version": "1.0.0", + "author": { + "name": "Claude Code Plugin Hub", + "email": "[email protected]" + }, + "skills": [ + "./skills" + ], + "commands": [ + "./commands" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..fc952a4 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# smoke-test-runner + +Quick smoke test suites to verify critical functionality after deployments diff --git a/commands/smoke-test.md b/commands/smoke-test.md new file mode 100644 index 0000000..6a18ec8 --- /dev/null +++ b/commands/smoke-test.md @@ -0,0 +1,216 @@ +--- +description: Run quick smoke tests to verify critical functionality +shortcut: st +--- + +# Smoke Test Runner + +Fast, focused smoke tests to verify critical application functionality after deployments. Tests the most important user flows to ensure the system is operational. + +## What You Do + +1. **Identify Critical Paths** + - Determine must-work functionality + - Map critical user journeys + - Prioritize high-value features + +2. **Generate Smoke Tests** + - Create fast, focused tests (<5min total) + - Cover authentication, core features, integrations + - Include health checks and basic assertions + +3. **Post-Deployment Validation** + - Run immediately after deployment + - Verify environment configuration + - Test external service connectivity + +4. **Report Results** + - Fast pass/fail indication + - Clear failure diagnostics + - Rollback recommendations if failing + +## Output Format + +```markdown +## Smoke Test Suite + +### Critical Paths: [N] +**Total Duration:** <5 minutes +**Environment:** [production/staging] + +### Test Suite + +\`\`\`javascript +// smoke-tests/critical-path.test.js +describe('Smoke Tests - Critical Path', () => { + const timeout = 30000; // 30s max per test + + describe('System Health', () => { + it('API is responding', async () => { + const response = await fetch('https://api.example.com/health'); + expect(response.status).toBe(200); + }, timeout); + + it('Database is accessible', async () => { + const result = await db.query('SELECT 1'); + expect(result).toBeDefined(); + }, timeout); + + it('Cache is working', async () => { + await redis.set('smoke:test', 'ok'); + const value = await redis.get('smoke:test'); + expect(value).toBe('ok'); + }, timeout); + }); + + describe('Authentication', () => { + it('User can login', async () => { + const response = await request(app) + .post('/api/auth/login') + .send({ email: '[email protected]', password: 'test123' }); + + expect(response.status).toBe(200); + expect(response.body.token).toBeDefined(); + }, timeout); + + it('Protected routes require authentication', async () => { + const response = await request(app) + .get('/api/user/profile'); + + expect(response.status).toBe(401); + }, timeout); + }); + + describe('Core Features', () => { + it('Homepage loads', async () => { + const response = await fetch('https://example.com'); + expect(response.status).toBe(200); + expect(await response.text()).toContain(''); + }, timeout); + + it('Search returns results', async () => { + const response = await request(app) + .get('/api/search?q=test'); + + expect(response.status).toBe(200); + expect(response.body.results).toBeDefined(); + }, timeout); + + it('Create operation works', async () => { + const response = await authenticatedRequest + .post('/api/items') + .send({ name: 'Smoke Test Item' }); + + expect(response.status).toBe(201); + expect(response.body.id).toBeDefined(); + }, timeout); + }); + + describe('External Integrations', () => { + it('Payment gateway is reachable', async () => { + const response = await stripe.paymentMethods.list({ limit: 1 }); + expect(response).toBeDefined(); + }, timeout); + + it('Email service is configured', async () => { + // Just verify config, don't send actual email + expect(process.env.SMTP_HOST).toBeDefined(); + expect(process.env.SMTP_PORT).toBeDefined(); + }, timeout); + + it('Storage is accessible', async () => { + const buckets = await s3.listBuckets(); + expect(buckets.Buckets.length).toBeGreaterThan(0); + }, timeout); + }); + + describe('Configuration', () => { + it('Environment variables are set', () => { + expect(process.env.NODE_ENV).toBeDefined(); + expect(process.env.DATABASE_URL).toBeDefined(); + expect(process.env.API_KEY).toBeDefined(); + }); + + it('Feature flags are loaded', async () => { + const flags = await featureFlags.getAll(); + expect(flags).toBeDefined(); + expect(flags.newFeature).toBe(false); // Verify expected state + }); + }); +}); +\`\`\` + +### Execution + +\`\`\`bash +# Run smoke tests +npm run test:smoke + +# Post-deployment hook +\`\`\`yaml +# .github/workflows/deploy.yml +- name: Run Smoke Tests + run: npm run test:smoke + if: success() + +- name: Rollback on Failure + run: ./scripts/rollback.sh + if: failure() +\`\`\` + +### Results + +\`\`\` +Smoke Tests - Critical Path + System Health + API is responding (245ms) + Database is accessible (189ms) + Cache is working (56ms) + + Authentication + User can login (432ms) + Protected routes require authentication (123ms) + + Core Features + Homepage loads (567ms) + Search returns results (289ms) + Create operation works (345ms) + + External Integrations + Payment gateway is reachable (678ms) + Email service is configured (12ms) + Storage is accessible (234ms) + + Configuration + Environment variables are set (8ms) + Feature flags are loaded (91ms) + +Total: 13 tests passing in 3.27s +\`\`\` + +### Smoke Test Matrix + +| Category | Tests | Status | Duration | +|----------|-------|--------|----------| +| System Health | 3 | Pass | 0.49s | +| Authentication | 2 | Pass | 0.56s | +| Core Features | 3 | Pass | 1.20s | +| Integrations | 3 | Pass | 0.92s | +| Configuration | 2 | Pass | 0.10s | + +**Total:** 3.27s All critical paths operational + +### Recommendations + Deployment successful - all critical paths working +- Monitor error rates for next 30 minutes +- Watch for performance degradation +``` + +## Best Practices + +- Keep total runtime under 5 minutes +- Test only critical, must-work functionality +- Run after every deployment +- Fail fast - stop on first critical failure +- Use real production-like data +- Test actual external services (not mocks) diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..07e8b54 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,61 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/testing/smoke-test-runner", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "f908297fe7f8f97a380b45ced3a0bb17c0faafaf", + "treeHash": "5615eee3f19f0920eb64555503639dee534a0e950b06ac44311612b8d7a2cb88", + "generatedAt": "2025-11-28T10:18:46.091189Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "smoke-test-runner", + "description": "Quick smoke test suites to verify critical functionality after deployments", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "4be01c7ded531283e34a9b254d3d610ac26a97ca6130b889271702fea56bdbb0" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "0f9376db666195b92d28149adc85eb94bfa64683e059f28d079172972c9d42e3" + }, + { + "path": "commands/smoke-test.md", + "sha256": "3e623cb64b2c23a2da9c30550118e10687a4fa65362ed840aa3d2641973e768d" + }, + { + "path": "skills/smoke-test-runner/SKILL.md", + "sha256": "e13a1d69a1282c38cb77ecb7977de6dd794f30a285cf490b16d62f010efa24f4" + }, + { + "path": "skills/smoke-test-runner/references/README.md", + "sha256": "eecaaf9bd46d22ec37f2b0731f1a47f7ea2614727030282f8ae7b940ee72358b" + }, + { + "path": "skills/smoke-test-runner/scripts/README.md", + "sha256": "665d8f6ab0621ae4e9892ea20dfc77f5339ae98b61c7fb09f79e419ec0f7cd38" + }, + { + "path": "skills/smoke-test-runner/assets/README.md", + "sha256": "879edc8c060c7073a9ff3f27a77d0d77bf69ebd42995728a6662c7b62672580b" + } + ], + "dirSha256": "5615eee3f19f0920eb64555503639dee534a0e950b06ac44311612b8d7a2cb88" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/smoke-test-runner/SKILL.md b/skills/smoke-test-runner/SKILL.md new file mode 100644 index 0000000..05f003a --- /dev/null +++ b/skills/smoke-test-runner/SKILL.md @@ -0,0 +1,52 @@ +--- +name: running-smoke-tests +description: | + This skill runs smoke tests to verify critical application functionality. It executes pre-defined test suites that check system health, authentication, core features, and external integrations. Use this skill after deployments, upgrades, or significant configuration changes to ensure the application is operational. Trigger this skill using the terms "smoke test" or "st". +allowed-tools: Read, Bash, Grep, Glob +version: 1.0.0 +--- + +## Overview + +This skill enables Claude to quickly verify the critical functionality of an application by running a suite of smoke tests. It provides a fast pass/fail assessment, helping to identify potential issues early in the deployment process. + +## How It Works + +1. **Initiate Smoke Test**: The user requests a smoke test using the `/smoke-test` or `/st` command. +2. **Execute Test Suite**: The skill executes the pre-defined suite of smoke tests, covering system health, authentication, core features, and external integrations. +3. **Report Results**: The skill provides a summary of the test results, indicating whether the tests passed or failed. + +## When to Use This Skill + +This skill activates when you need to: +- Verify application functionality after a deployment. +- Confirm system health after an upgrade. +- Sanity-check critical features after configuration changes. + +## Examples + +### Example 1: Post-Deployment Verification + +User request: "Run a smoke test after deploying the new version." + +The skill will: +1. Execute the smoke test suite. +2. Report the pass/fail status of each test, highlighting any failures in authentication or core feature validation. + +### Example 2: Configuration Change Validation + +User request: "/st to validate the recent database configuration changes." + +The skill will: +1. Execute the smoke test suite. +2. Report the results, specifically checking the system health and integration tests to ensure the database changes didn't introduce issues. + +## Best Practices + +- **Focus**: Ensure smoke tests focus on the most critical user flows and system components. +- **Speed**: Keep the smoke test suite execution time under 5 minutes for rapid feedback. +- **Integration**: Integrate smoke tests into your CI/CD pipeline for automated post-deployment verification. + +## Integration + +This skill can be used in conjunction with other deployment and monitoring tools to provide a comprehensive view of application health and stability. It works independently, requiring only the `/smoke-test` or `/st` command to initiate. \ No newline at end of file diff --git a/skills/smoke-test-runner/assets/README.md b/skills/smoke-test-runner/assets/README.md new file mode 100644 index 0000000..97eea1c --- /dev/null +++ b/skills/smoke-test-runner/assets/README.md @@ -0,0 +1,7 @@ +# Assets + +Bundled resources for smoke-test-runner skill + +- [ ] test_suite_template.json A template for creating new smoke test suites. +- [ ] sample_results.json A sample of the test results format. +- [ ] config_template.yaml A template for the application configuration. diff --git a/skills/smoke-test-runner/references/README.md b/skills/smoke-test-runner/references/README.md new file mode 100644 index 0000000..90fd824 --- /dev/null +++ b/skills/smoke-test-runner/references/README.md @@ -0,0 +1,7 @@ +# References + +Bundled resources for smoke-test-runner skill + +- [ ] test_suite_definition.md Describes the structure and content of the smoke test suite. +- [ ] environment_variables.md Lists and describes the required environment variables. +- [ ] error_codes.md Explains the different error codes that can be returned by the tests. diff --git a/skills/smoke-test-runner/scripts/README.md b/skills/smoke-test-runner/scripts/README.md new file mode 100644 index 0000000..2885453 --- /dev/null +++ b/skills/smoke-test-runner/scripts/README.md @@ -0,0 +1,7 @@ +# Scripts + +Bundled resources for smoke-test-runner skill + +- [ ] run_tests.sh Executes the smoke test suite and reports results. +- [ ] parse_results.py Parses the test results and provides a summary. +- [ ] setup_env.sh Sets up the environment for running the smoke tests.