@codyswann/lisa 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +867 -0
- package/all/copy-overwrite/.claude/README.md +205 -0
- package/all/copy-overwrite/.claude/agents/agent-architect.md +311 -0
- package/all/copy-overwrite/.claude/agents/codebase-analyzer.md +146 -0
- package/all/copy-overwrite/.claude/agents/codebase-locator.md +125 -0
- package/all/copy-overwrite/.claude/agents/codebase-pattern-finder.md +237 -0
- package/all/copy-overwrite/.claude/agents/git-history-analyzer.md +183 -0
- package/all/copy-overwrite/.claude/agents/hooks-expert.md +74 -0
- package/all/copy-overwrite/.claude/agents/skill-evaluator.md +246 -0
- package/all/copy-overwrite/.claude/agents/slash-command-architect.md +87 -0
- package/all/copy-overwrite/.claude/agents/web-search-researcher.md +112 -0
- package/all/copy-overwrite/.claude/commands/git/commit-and-submit-pr.md +8 -0
- package/all/copy-overwrite/.claude/commands/git/commit.md +44 -0
- package/all/copy-overwrite/.claude/commands/git/prune.md +34 -0
- package/all/copy-overwrite/.claude/commands/git/submit-pr.md +50 -0
- package/all/copy-overwrite/.claude/commands/jira/create.md +50 -0
- package/all/copy-overwrite/.claude/commands/jira/verify.md +34 -0
- package/all/copy-overwrite/.claude/commands/project/archive.md +8 -0
- package/all/copy-overwrite/.claude/commands/project/bootstrap.md +49 -0
- package/all/copy-overwrite/.claude/commands/project/complete-task.md +7 -0
- package/all/copy-overwrite/.claude/commands/project/debrief.md +65 -0
- package/all/copy-overwrite/.claude/commands/project/execute.md +94 -0
- package/all/copy-overwrite/.claude/commands/project/implement.md +42 -0
- package/all/copy-overwrite/.claude/commands/project/local-code-review.md +88 -0
- package/all/copy-overwrite/.claude/commands/project/lower-code-complexity.md +74 -0
- package/all/copy-overwrite/.claude/commands/project/plan.md +314 -0
- package/all/copy-overwrite/.claude/commands/project/research.md +248 -0
- package/all/copy-overwrite/.claude/commands/project/review.md +63 -0
- package/all/copy-overwrite/.claude/commands/project/setup.md +19 -0
- package/all/copy-overwrite/.claude/commands/project/verify.md +38 -0
- package/all/copy-overwrite/.claude/commands/pull-request/review.md +12 -0
- package/all/copy-overwrite/.claude/commands/rules/format-md.md +72 -0
- package/all/copy-overwrite/.claude/commands/sonarqube/check.md +6 -0
- package/all/copy-overwrite/.claude/commands/sonarqube/fix.md +3 -0
- package/all/copy-overwrite/.claude/hooks/README.md +301 -0
- package/all/copy-overwrite/.claude/hooks/notify-ntfy.sh +181 -0
- package/all/copy-overwrite/.claude/settings.json +41 -0
- package/all/copy-overwrite/.claude/settings.local.json.example +14 -0
- package/all/copy-overwrite/.claude/skills/coding-philosophy/SKILL.md +405 -0
- package/all/copy-overwrite/.claude/skills/coding-philosophy/references/function-structure.md +416 -0
- package/all/copy-overwrite/.claude/skills/coding-philosophy/references/immutable-patterns.md +316 -0
- package/all/copy-overwrite/.claude/skills/prompt-complexity-scorer/SKILL.md +118 -0
- package/all/copy-overwrite/.claude/skills/skill-creator/LICENSE.txt +202 -0
- package/all/copy-overwrite/.claude/skills/skill-creator/SKILL.md +210 -0
- package/all/copy-overwrite/.claude/skills/skill-creator/scripts/__pycache__/quick_validate.cpython-312.pyc +0 -0
- package/all/copy-overwrite/.claude/skills/skill-creator/scripts/init_skill.py +303 -0
- package/all/copy-overwrite/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
- package/all/copy-overwrite/.claude/skills/skill-creator/scripts/quick_validate.py +65 -0
- package/all/copy-overwrite/CLAUDE.md +77 -0
- package/all/copy-overwrite/HUMAN.md +17 -0
- package/all/copy-overwrite/specs/.keep +0 -0
- package/all/create-only/PROJECT_RULES.md +0 -0
- package/cdk/merge/package.json +20 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +107 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/prompts.d.ts +45 -0
- package/dist/cli/prompts.d.ts.map +1 -0
- package/dist/cli/prompts.js +58 -0
- package/dist/cli/prompts.js.map +1 -0
- package/dist/core/config.d.ts +73 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +36 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +4 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/lisa.d.ts +81 -0
- package/dist/core/lisa.d.ts.map +1 -0
- package/dist/core/lisa.js +459 -0
- package/dist/core/lisa.js.map +1 -0
- package/dist/core/manifest.d.ts +58 -0
- package/dist/core/manifest.d.ts.map +1 -0
- package/dist/core/manifest.js +104 -0
- package/dist/core/manifest.js.map +1 -0
- package/dist/detection/detector.interface.d.ts +15 -0
- package/dist/detection/detector.interface.d.ts.map +1 -0
- package/dist/detection/detector.interface.js +2 -0
- package/dist/detection/detector.interface.js.map +1 -0
- package/dist/detection/detectors/cdk.d.ts +10 -0
- package/dist/detection/detectors/cdk.d.ts.map +1 -0
- package/dist/detection/detectors/cdk.js +34 -0
- package/dist/detection/detectors/cdk.js.map +1 -0
- package/dist/detection/detectors/expo.d.ts +10 -0
- package/dist/detection/detectors/expo.d.ts.map +1 -0
- package/dist/detection/detectors/expo.js +30 -0
- package/dist/detection/detectors/expo.js.map +1 -0
- package/dist/detection/detectors/nestjs.d.ts +10 -0
- package/dist/detection/detectors/nestjs.d.ts.map +1 -0
- package/dist/detection/detectors/nestjs.js +34 -0
- package/dist/detection/detectors/nestjs.js.map +1 -0
- package/dist/detection/detectors/npm-package.d.ts +13 -0
- package/dist/detection/detectors/npm-package.d.ts.map +1 -0
- package/dist/detection/detectors/npm-package.js +30 -0
- package/dist/detection/detectors/npm-package.js.map +1 -0
- package/dist/detection/detectors/typescript.d.ts +10 -0
- package/dist/detection/detectors/typescript.d.ts.map +1 -0
- package/dist/detection/detectors/typescript.js +25 -0
- package/dist/detection/detectors/typescript.js.map +1 -0
- package/dist/detection/index.d.ts +24 -0
- package/dist/detection/index.d.ts.map +1 -0
- package/dist/detection/index.js +57 -0
- package/dist/detection/index.js.map +1 -0
- package/dist/errors/index.d.ts +69 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +110 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/console-logger.d.ts +12 -0
- package/dist/logging/console-logger.d.ts.map +1 -0
- package/dist/logging/console-logger.js +22 -0
- package/dist/logging/console-logger.js.map +1 -0
- package/dist/logging/index.d.ts +4 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +3 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/logger.interface.d.ts +20 -0
- package/dist/logging/logger.interface.d.ts.map +1 -0
- package/dist/logging/logger.interface.js +2 -0
- package/dist/logging/logger.interface.js.map +1 -0
- package/dist/logging/silent-logger.d.ts +12 -0
- package/dist/logging/silent-logger.d.ts.map +1 -0
- package/dist/logging/silent-logger.js +21 -0
- package/dist/logging/silent-logger.js.map +1 -0
- package/dist/strategies/copy-contents.d.ts +14 -0
- package/dist/strategies/copy-contents.d.ts.map +1 -0
- package/dist/strategies/copy-contents.js +69 -0
- package/dist/strategies/copy-contents.js.map +1 -0
- package/dist/strategies/copy-overwrite.d.ts +14 -0
- package/dist/strategies/copy-overwrite.d.ts.map +1 -0
- package/dist/strategies/copy-overwrite.js +47 -0
- package/dist/strategies/copy-overwrite.js.map +1 -0
- package/dist/strategies/create-only.d.ts +13 -0
- package/dist/strategies/create-only.d.ts.map +1 -0
- package/dist/strategies/create-only.js +30 -0
- package/dist/strategies/create-only.js.map +1 -0
- package/dist/strategies/index.d.ts +31 -0
- package/dist/strategies/index.d.ts.map +1 -0
- package/dist/strategies/index.js +52 -0
- package/dist/strategies/index.js.map +1 -0
- package/dist/strategies/merge.d.ts +13 -0
- package/dist/strategies/merge.d.ts.map +1 -0
- package/dist/strategies/merge.js +60 -0
- package/dist/strategies/merge.js.map +1 -0
- package/dist/strategies/strategy.interface.d.ts +31 -0
- package/dist/strategies/strategy.interface.d.ts.map +1 -0
- package/dist/strategies/strategy.interface.js +2 -0
- package/dist/strategies/strategy.interface.js.map +1 -0
- package/dist/transaction/backup.d.ts +38 -0
- package/dist/transaction/backup.d.ts.map +1 -0
- package/dist/transaction/backup.js +97 -0
- package/dist/transaction/backup.js.map +1 -0
- package/dist/transaction/index.d.ts +4 -0
- package/dist/transaction/index.d.ts.map +1 -0
- package/dist/transaction/index.js +3 -0
- package/dist/transaction/index.js.map +1 -0
- package/dist/transaction/transaction.d.ts +34 -0
- package/dist/transaction/transaction.d.ts.map +1 -0
- package/dist/transaction/transaction.js +68 -0
- package/dist/transaction/transaction.js.map +1 -0
- package/dist/utils/file-operations.d.ts +29 -0
- package/dist/utils/file-operations.d.ts.map +1 -0
- package/dist/utils/file-operations.js +84 -0
- package/dist/utils/file-operations.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/json-utils.d.ts +22 -0
- package/dist/utils/json-utils.d.ts.map +1 -0
- package/dist/utils/json-utils.js +57 -0
- package/dist/utils/json-utils.js.map +1 -0
- package/dist/utils/path-utils.d.ts +21 -0
- package/dist/utils/path-utils.d.ts.map +1 -0
- package/dist/utils/path-utils.js +35 -0
- package/dist/utils/path-utils.js.map +1 -0
- package/eslint-plugin-code-organization/README.md +149 -0
- package/eslint-plugin-code-organization/__tests__/enforce-statement-order.test.js +468 -0
- package/eslint-plugin-code-organization/index.js +23 -0
- package/eslint-plugin-code-organization/package.json +10 -0
- package/eslint-plugin-code-organization/rules/enforce-statement-order.js +157 -0
- package/expo/copy-overwrite/.claude/skills/apollo-client/SKILL.md +238 -0
- package/expo/copy-overwrite/.claude/skills/apollo-client/references/mutation-patterns.md +360 -0
- package/expo/copy-overwrite/.claude/skills/atomic-design-gluestack/SKILL.md +360 -0
- package/expo/copy-overwrite/.claude/skills/atomic-design-gluestack/references/atomic-levels.md +417 -0
- package/expo/copy-overwrite/.claude/skills/atomic-design-gluestack/references/folder-structure.md +257 -0
- package/expo/copy-overwrite/.claude/skills/atomic-design-gluestack/references/gluestack-mapping.md +233 -0
- package/expo/copy-overwrite/.claude/skills/atomic-design-gluestack/scripts/validate_atomic_structure.py +327 -0
- package/expo/copy-overwrite/.claude/skills/container-view-pattern/SKILL.md +299 -0
- package/expo/copy-overwrite/.claude/skills/container-view-pattern/references/examples.md +749 -0
- package/expo/copy-overwrite/.claude/skills/container-view-pattern/references/patterns.md +318 -0
- package/expo/copy-overwrite/.claude/skills/container-view-pattern/scripts/create_component.py +198 -0
- package/expo/copy-overwrite/.claude/skills/container-view-pattern/scripts/validate_component.py +207 -0
- package/expo/copy-overwrite/.claude/skills/cross-platform-compatibility/SKILL.md +268 -0
- package/expo/copy-overwrite/.claude/skills/cross-platform-compatibility/references/common-issues.md +619 -0
- package/expo/copy-overwrite/.claude/skills/cross-platform-compatibility/references/file-extensions.md +340 -0
- package/expo/copy-overwrite/.claude/skills/cross-platform-compatibility/references/platform-api.md +276 -0
- package/expo/copy-overwrite/.claude/skills/cross-platform-compatibility/scripts/validate_cross_platform.py +414 -0
- package/expo/copy-overwrite/.claude/skills/directory-structure/SKILL.md +202 -0
- package/expo/copy-overwrite/.claude/skills/directory-structure/scripts/validate_structure.py +443 -0
- package/expo/copy-overwrite/.claude/skills/expo-env-config/SKILL.md +309 -0
- package/expo/copy-overwrite/.claude/skills/expo-env-config/references/validation-patterns.md +417 -0
- package/expo/copy-overwrite/.claude/skills/expo-router-best-practices/SKILL.md +431 -0
- package/expo/copy-overwrite/.claude/skills/expo-router-best-practices/references/official-docs.md +290 -0
- package/expo/copy-overwrite/.claude/skills/expo-router-best-practices/scripts/generate-route.py +169 -0
- package/expo/copy-overwrite/.claude/skills/gluestack-nativewind/SKILL.md +411 -0
- package/expo/copy-overwrite/.claude/skills/gluestack-nativewind/references/color-tokens.md +343 -0
- package/expo/copy-overwrite/.claude/skills/gluestack-nativewind/references/component-mapping.md +307 -0
- package/expo/copy-overwrite/.claude/skills/gluestack-nativewind/references/spacing-scale.md +300 -0
- package/expo/copy-overwrite/.claude/skills/gluestack-nativewind/scripts/validate_styling.py +354 -0
- package/expo/copy-overwrite/.claude/skills/local-state/SKILL.md +362 -0
- package/expo/copy-overwrite/.claude/skills/local-state/references/async-storage.md +505 -0
- package/expo/copy-overwrite/.claude/skills/local-state/references/persistence-patterns.md +711 -0
- package/expo/copy-overwrite/.claude/skills/local-state/references/reactive-variables.md +446 -0
- package/expo/copy-overwrite/.claude/skills/playwright-selectors/SKILL.md +223 -0
- package/expo/copy-overwrite/.claude/skills/testing-library/SKILL.md +319 -0
- package/expo/copy-overwrite/.claude/skills/testing-library/references/async-patterns.md +420 -0
- package/expo/copy-overwrite/.claude/skills/testing-library/references/expo-router-testing.md +556 -0
- package/expo/copy-overwrite/.claude/skills/testing-library/references/mocking-patterns.md +590 -0
- package/expo/copy-overwrite/.claude/skills/testing-library/references/query-priority.md +291 -0
- package/expo/copy-overwrite/.easignore.extra +2 -0
- package/expo/copy-overwrite/.mcp.json +33 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/README.md +234 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/__tests__/plugin-index.test.js +84 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/__tests__/require-memo-in-view.test.js +196 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/__tests__/single-component-per-file.test.js +289 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/index.js +32 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/package.json +10 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/rules/enforce-component-structure.js +230 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/rules/no-return-in-view.js +91 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/rules/require-memo-in-view.js +178 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/rules/single-component-per-file.js +238 -0
- package/expo/copy-overwrite/eslint-plugin-ui-standards/README.md +260 -0
- package/expo/copy-overwrite/eslint-plugin-ui-standards/index.js +29 -0
- package/expo/copy-overwrite/eslint-plugin-ui-standards/package.json +10 -0
- package/expo/copy-overwrite/eslint-plugin-ui-standards/rules/no-classname-outside-ui.js +51 -0
- package/expo/copy-overwrite/eslint-plugin-ui-standards/rules/no-direct-rn-imports.js +55 -0
- package/expo/copy-overwrite/eslint-plugin-ui-standards/rules/no-inline-styles.js +73 -0
- package/expo/copy-overwrite/eslint.config.mjs +560 -0
- package/expo/copy-overwrite/lighthouserc.js +194 -0
- package/expo/create-only/lighthouserc-config.json +28 -0
- package/expo/merge/package.json +132 -0
- package/lisa.sh +35 -0
- package/nestjs/copy-overwrite/.claude/skills/nestjs-graphql/SKILL.md +176 -0
- package/nestjs/copy-overwrite/.claude/skills/nestjs-graphql/references/advanced-features.md +527 -0
- package/nestjs/copy-overwrite/.claude/skills/nestjs-graphql/references/project-patterns.md +483 -0
- package/nestjs/copy-overwrite/.claude/skills/nestjs-graphql/references/quick-start.md +257 -0
- package/nestjs/copy-overwrite/.claude/skills/nestjs-graphql/references/resolvers-mutations.md +413 -0
- package/nestjs/copy-overwrite/.claude/skills/nestjs-graphql/references/types-scalars.md +513 -0
- package/nestjs/copy-overwrite/.claude/skills/nestjs-rules/SKILL.md +536 -0
- package/nestjs/copy-overwrite/.claude/skills/typeorm-patterns/SKILL.md +275 -0
- package/nestjs/copy-overwrite/.claude/skills/typeorm-patterns/references/configuration-patterns.md +487 -0
- package/nestjs/copy-overwrite/.claude/skills/typeorm-patterns/references/entity-patterns.md +450 -0
- package/nestjs/copy-overwrite/.claude/skills/typeorm-patterns/references/observability-patterns.md +536 -0
- package/nestjs/merge/package.json +75 -0
- package/package.json +124 -0
- package/typescript/copy-contents/.husky/commit-msg +91 -0
- package/typescript/copy-contents/.husky/pre-commit +96 -0
- package/typescript/copy-contents/.husky/pre-push +211 -0
- package/typescript/copy-overwrite/.claude/hooks/format-on-edit.sh +74 -0
- package/typescript/copy-overwrite/.claude/hooks/install_pkgs.sh +59 -0
- package/typescript/copy-overwrite/.claude/hooks/lint-on-edit.sh +103 -0
- package/typescript/copy-overwrite/.claude/skills/jsdoc-best-practices/SKILL.md +388 -0
- package/typescript/copy-overwrite/.github/README.md +455 -0
- package/typescript/copy-overwrite/.github/dependabot.yml +40 -0
- package/typescript/copy-overwrite/.github/k6/BROWSER_TESTING_NOTE.md +129 -0
- package/typescript/copy-overwrite/.github/k6/INTEGRATION_GUIDE.md +354 -0
- package/typescript/copy-overwrite/.github/k6/README.md +386 -0
- package/typescript/copy-overwrite/.github/k6/SCENARIO_SELECTION_GUIDE.md +264 -0
- package/typescript/copy-overwrite/.github/k6/examples/customer-deploy-integration.yml +115 -0
- package/typescript/copy-overwrite/.github/k6/examples/data-driven-test.js +268 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/load.js +142 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/load.json +27 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/smoke.js +26 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/smoke.json +20 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/soak.js +244 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/soak.json +29 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/spike.js +180 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/spike.json +32 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/stress.js +206 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/stress.json +38 -0
- package/typescript/copy-overwrite/.github/k6/scripts/api-test.js +452 -0
- package/typescript/copy-overwrite/.github/k6/scripts/default-test.js +185 -0
- package/typescript/copy-overwrite/.github/k6/thresholds/normal.json +30 -0
- package/typescript/copy-overwrite/.github/k6/thresholds/relaxed.json +21 -0
- package/typescript/copy-overwrite/.github/k6/thresholds/strict.json +29 -0
- package/typescript/copy-overwrite/.github/workflows/build.yml +72 -0
- package/typescript/copy-overwrite/.github/workflows/ci.yml +49 -0
- package/typescript/copy-overwrite/.github/workflows/claude.yml +51 -0
- package/typescript/copy-overwrite/.github/workflows/create-github-issue-on-failure.yml +113 -0
- package/typescript/copy-overwrite/.github/workflows/create-jira-issue-on-failure.yml +195 -0
- package/typescript/copy-overwrite/.github/workflows/create-sentry-issue-on-failure.yml +267 -0
- package/typescript/copy-overwrite/.github/workflows/deploy.yml +228 -0
- package/typescript/copy-overwrite/.github/workflows/k6-load-test-README.md +230 -0
- package/typescript/copy-overwrite/.github/workflows/lighthouse.yml +68 -0
- package/typescript/copy-overwrite/.github/workflows/load-test.yml +282 -0
- package/typescript/copy-overwrite/.github/workflows/quality.yml +1737 -0
- package/typescript/copy-overwrite/.github/workflows/release.yml +1599 -0
- package/typescript/copy-overwrite/.gitleaksignore +28 -0
- package/typescript/copy-overwrite/.nvmrc +1 -0
- package/typescript/copy-overwrite/.prettierignore +23 -0
- package/typescript/copy-overwrite/.prettierrc.json +22 -0
- package/typescript/copy-overwrite/.versionrc +42 -0
- package/typescript/copy-overwrite/.yamllint +20 -0
- package/typescript/copy-overwrite/commitlint.config.js +11 -0
- package/typescript/copy-overwrite/eslint-plugin-code-organization/README.md +149 -0
- package/typescript/copy-overwrite/eslint-plugin-code-organization/__tests__/enforce-statement-order.test.js +468 -0
- package/typescript/copy-overwrite/eslint-plugin-code-organization/index.js +23 -0
- package/typescript/copy-overwrite/eslint-plugin-code-organization/package.json +10 -0
- package/typescript/copy-overwrite/eslint-plugin-code-organization/rules/enforce-statement-order.js +157 -0
- package/typescript/copy-overwrite/eslint.config.mjs +390 -0
- package/typescript/copy-overwrite/eslint.ignore.config.json +57 -0
- package/typescript/copy-overwrite/eslint.thresholds.config.json +5 -0
- package/typescript/github-rulesets/base.json +106 -0
- package/typescript/merge/.claude/settings.json +28 -0
- package/typescript/merge/package.json +71 -0
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
# K6 Load Testing
|
|
2
|
+
|
|
3
|
+
This directory contains the k6 load testing framework for performance testing. The setup supports both **local development** and **CI/CD pipelines** using a shared implementation.
|
|
4
|
+
|
|
5
|
+
## Quick Start - Local Development
|
|
6
|
+
|
|
7
|
+
The fastest way to run load tests locally:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Run smoke test against local server (default: http://localhost:3000)
|
|
11
|
+
bun run k6:smoke
|
|
12
|
+
|
|
13
|
+
# Run load test against a specific URL
|
|
14
|
+
bun run k6:load -- --url https://staging.example.com
|
|
15
|
+
|
|
16
|
+
# Run with Docker (no k6 installation required)
|
|
17
|
+
bun run k6:docker:smoke
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Prerequisites
|
|
21
|
+
|
|
22
|
+
You need one of the following:
|
|
23
|
+
- **k6 installed locally**: [Installation guide](https://k6.io/docs/get-started/installation/)
|
|
24
|
+
- **Docker**: The runner auto-detects and uses Docker if k6 isn't installed
|
|
25
|
+
|
|
26
|
+
### Available npm Scripts
|
|
27
|
+
|
|
28
|
+
| Script | Description |
|
|
29
|
+
|--------|-------------|
|
|
30
|
+
| `bun run k6` | Run with custom options (see `--help`) |
|
|
31
|
+
| `bun run k6:smoke` | Quick verification (1 VU, 1 min) |
|
|
32
|
+
| `bun run k6:load` | Normal traffic simulation (10 VUs, 9 min) |
|
|
33
|
+
| `bun run k6:stress` | Find breaking points (up to 30 VUs) |
|
|
34
|
+
| `bun run k6:spike` | Test sudden traffic spikes |
|
|
35
|
+
| `bun run k6:soak` | Extended duration testing (30+ min) |
|
|
36
|
+
| `bun run k6:docker:smoke` | Smoke test via Docker |
|
|
37
|
+
| `bun run k6:docker:load` | Load test via Docker |
|
|
38
|
+
|
|
39
|
+
### Direct Script Usage
|
|
40
|
+
|
|
41
|
+
For more control, use the runner script directly:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Show all options
|
|
45
|
+
./scripts/k6-run.sh --help
|
|
46
|
+
|
|
47
|
+
# Run smoke test with JSON output
|
|
48
|
+
./scripts/k6-run.sh --scenario smoke --json
|
|
49
|
+
|
|
50
|
+
# Run load test against staging with HTML report
|
|
51
|
+
./scripts/k6-run.sh --scenario load --url https://staging.example.com --html
|
|
52
|
+
|
|
53
|
+
# Run custom script
|
|
54
|
+
./scripts/k6-run.sh --script .github/k6/scripts/api-test.js --url http://localhost:3000
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Docker Compose
|
|
58
|
+
|
|
59
|
+
For containerized testing:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Run smoke test
|
|
63
|
+
docker compose -f docker-compose.k6.yml run --rm k6-smoke
|
|
64
|
+
|
|
65
|
+
# Run against custom URL
|
|
66
|
+
K6_BASE_URL=https://staging.example.com docker compose -f docker-compose.k6.yml run --rm k6-load
|
|
67
|
+
|
|
68
|
+
# Run with other services
|
|
69
|
+
docker compose -f docker-compose.yml -f docker-compose.k6.yml up -d postgres valkey
|
|
70
|
+
docker compose -f docker-compose.yml -f docker-compose.k6.yml run --rm k6-smoke
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## CI/CD Integration
|
|
76
|
+
|
|
77
|
+
The k6 load testing workflow is designed as a **callable workflow** that can be integrated into any deployment pipeline. It provides:
|
|
78
|
+
|
|
79
|
+
- Multiple test scenarios (smoke, load, stress, spike, soak)
|
|
80
|
+
- Configurable thresholds and performance criteria
|
|
81
|
+
- Support for both local and k6 Cloud runs
|
|
82
|
+
- Detailed reporting and GitHub Actions integration
|
|
83
|
+
- Flexible authentication for testing protected endpoints
|
|
84
|
+
|
|
85
|
+
## Directory Structure
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
.github/k6/
|
|
89
|
+
├── README.md # This file
|
|
90
|
+
├── scripts/ # Test scripts
|
|
91
|
+
│ ├── default-test.js # Default test with all scenarios
|
|
92
|
+
│ ├── api-test.js # Comprehensive API testing
|
|
93
|
+
│ └── browser-test.js # Browser testing (coming soon)
|
|
94
|
+
├── scenarios/ # Scenario configurations and scripts
|
|
95
|
+
│ ├── smoke.json # Smoke test configuration
|
|
96
|
+
│ ├── smoke.js # Smoke test implementation
|
|
97
|
+
│ ├── load.json # Load test configuration
|
|
98
|
+
│ ├── load.js # Load test implementation
|
|
99
|
+
│ ├── stress.json # Stress test configuration
|
|
100
|
+
│ ├── stress.js # Stress test implementation
|
|
101
|
+
│ ├── spike.json # Spike test configuration
|
|
102
|
+
│ ├── spike.js # Spike test implementation
|
|
103
|
+
│ ├── soak.json # Soak test configuration
|
|
104
|
+
│ └── soak.js # Soak test implementation
|
|
105
|
+
├── thresholds/ # Threshold configurations
|
|
106
|
+
│ ├── strict.json # Strict performance criteria
|
|
107
|
+
│ ├── normal.json # Standard criteria
|
|
108
|
+
│ └── relaxed.json # Relaxed criteria for development
|
|
109
|
+
└── examples/ # Integration and usage examples
|
|
110
|
+
├── customer-deploy-integration.yml
|
|
111
|
+
└── data-driven-test.js # Data parameterization example
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Usage
|
|
115
|
+
|
|
116
|
+
### Basic Integration
|
|
117
|
+
|
|
118
|
+
Add this to your deployment workflow:
|
|
119
|
+
|
|
120
|
+
```yaml
|
|
121
|
+
jobs:
|
|
122
|
+
deploy:
|
|
123
|
+
# ... your deployment steps ...
|
|
124
|
+
|
|
125
|
+
performance_test:
|
|
126
|
+
needs: deploy
|
|
127
|
+
uses: ./.github/workflows/k6-load-test.yml
|
|
128
|
+
with:
|
|
129
|
+
environment: staging
|
|
130
|
+
test_scenario: smoke
|
|
131
|
+
base_url: ${{ needs.deploy.outputs.app_url }}
|
|
132
|
+
secrets: inherit
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Available Inputs
|
|
136
|
+
|
|
137
|
+
| Input | Description | Required | Default |
|
|
138
|
+
|-------|-------------|----------|---------|
|
|
139
|
+
| `environment` | Target environment (staging, production) | Yes | - |
|
|
140
|
+
| `test_scenario` | Test type: smoke, load, stress, spike, soak | No | smoke |
|
|
141
|
+
| `base_url` | Base URL of the application to test | Yes | - |
|
|
142
|
+
| `k6_version` | k6 version to use | No | latest |
|
|
143
|
+
| `test_duration` | Override test duration (e.g., 5m, 1h) | No | Scenario default |
|
|
144
|
+
| `virtual_users` | Override number of virtual users | No | Scenario default |
|
|
145
|
+
| `thresholds_config` | Path to custom thresholds JSON | No | Built-in thresholds |
|
|
146
|
+
| `test_script` | Path to custom k6 test script | No | default-test.js |
|
|
147
|
+
| `fail_on_threshold` | Fail workflow if thresholds not met | No | true |
|
|
148
|
+
| `upload_results` | Upload results as artifacts | No | true |
|
|
149
|
+
| `cloud_run` | Run on k6 Cloud (requires token) | No | false |
|
|
150
|
+
|
|
151
|
+
### Test Scenarios
|
|
152
|
+
|
|
153
|
+
#### Smoke Test
|
|
154
|
+
- **Purpose**: Verify system works under minimal load
|
|
155
|
+
- **Duration**: 1 minute
|
|
156
|
+
- **VUs**: 1
|
|
157
|
+
- **Use case**: Post-deployment verification
|
|
158
|
+
|
|
159
|
+
#### Load Test
|
|
160
|
+
- **Purpose**: Test under normal expected load
|
|
161
|
+
- **Duration**: 9 minutes (ramp up, sustain, ramp down)
|
|
162
|
+
- **VUs**: 10 (configurable)
|
|
163
|
+
- **Use case**: Regular performance validation
|
|
164
|
+
|
|
165
|
+
#### Stress Test
|
|
166
|
+
- **Purpose**: Find breaking points
|
|
167
|
+
- **Duration**: 24 minutes with increasing load
|
|
168
|
+
- **VUs**: Up to 30
|
|
169
|
+
- **Use case**: Capacity planning
|
|
170
|
+
|
|
171
|
+
#### Spike Test
|
|
172
|
+
- **Purpose**: Test sudden traffic increases
|
|
173
|
+
- **Duration**: ~8 minutes with rapid changes
|
|
174
|
+
- **VUs**: 5 to 50 spike
|
|
175
|
+
- **Use case**: Flash sale or viral content scenarios
|
|
176
|
+
|
|
177
|
+
#### Soak Test
|
|
178
|
+
- **Purpose**: Extended duration testing
|
|
179
|
+
- **Duration**: 30 minutes (configurable)
|
|
180
|
+
- **VUs**: 10 constant
|
|
181
|
+
- **Use case**: Memory leak detection
|
|
182
|
+
|
|
183
|
+
### Authentication
|
|
184
|
+
|
|
185
|
+
For testing protected endpoints, provide custom headers:
|
|
186
|
+
|
|
187
|
+
```yaml
|
|
188
|
+
uses: ./.github/workflows/k6-load-test.yml
|
|
189
|
+
with:
|
|
190
|
+
base_url: https://api.example.com
|
|
191
|
+
test_scenario: load
|
|
192
|
+
secrets:
|
|
193
|
+
CUSTOM_HEADERS: |
|
|
194
|
+
{
|
|
195
|
+
"Authorization": "Bearer ${{ secrets.API_TOKEN }}",
|
|
196
|
+
"X-API-Key": "${{ secrets.API_KEY }}"
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Custom Test Scripts
|
|
201
|
+
|
|
202
|
+
Create your own test script:
|
|
203
|
+
|
|
204
|
+
```javascript
|
|
205
|
+
// .github/k6/custom-api-test.js
|
|
206
|
+
import http from 'k6/http';
|
|
207
|
+
import { check } from 'k6';
|
|
208
|
+
|
|
209
|
+
export const options = {
|
|
210
|
+
scenarios: {
|
|
211
|
+
api_test: {
|
|
212
|
+
executor: 'constant-vus',
|
|
213
|
+
vus: 5,
|
|
214
|
+
duration: '30s',
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
thresholds: {
|
|
218
|
+
http_req_failed: ['rate<0.1'],
|
|
219
|
+
http_req_duration: ['p(95)<500'],
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export default function () {
|
|
224
|
+
const response = http.post(
|
|
225
|
+
`${__ENV.K6_BASE_URL}/api/endpoint`,
|
|
226
|
+
JSON.stringify({ data: 'test' }),
|
|
227
|
+
{ headers: { 'Content-Type': 'application/json' } }
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
check(response, {
|
|
231
|
+
'status is 201': (r) => r.status === 201,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Then use it:
|
|
237
|
+
|
|
238
|
+
```yaml
|
|
239
|
+
uses: ./.github/workflows/k6-load-test.yml
|
|
240
|
+
with:
|
|
241
|
+
test_script: .github/k6/custom-api-test.js
|
|
242
|
+
base_url: https://api.example.com
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Threshold Configuration
|
|
246
|
+
|
|
247
|
+
Create custom thresholds:
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"thresholds": {
|
|
252
|
+
"http_req_failed": {
|
|
253
|
+
"threshold": "rate<0.05",
|
|
254
|
+
"abortOnFail": true
|
|
255
|
+
},
|
|
256
|
+
"http_req_duration": {
|
|
257
|
+
"threshold": "p(99)<1000"
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Use with:
|
|
264
|
+
|
|
265
|
+
```yaml
|
|
266
|
+
uses: ./.github/workflows/k6-load-test.yml
|
|
267
|
+
with:
|
|
268
|
+
thresholds_config: .github/k6/thresholds/custom.json
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### K6 Cloud Integration
|
|
272
|
+
|
|
273
|
+
For k6 Cloud runs:
|
|
274
|
+
|
|
275
|
+
1. Add your k6 Cloud token as a secret: `K6_CLOUD_TOKEN`
|
|
276
|
+
2. Enable cloud runs:
|
|
277
|
+
|
|
278
|
+
```yaml
|
|
279
|
+
uses: ./.github/workflows/k6-load-test.yml
|
|
280
|
+
with:
|
|
281
|
+
cloud_run: true
|
|
282
|
+
base_url: https://api.example.com
|
|
283
|
+
secrets:
|
|
284
|
+
K6_CLOUD_TOKEN: ${{ secrets.K6_CLOUD_TOKEN }}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Best Practices
|
|
288
|
+
|
|
289
|
+
1. **Start with Smoke Tests**: Always run smoke tests first
|
|
290
|
+
2. **Gradual Load Increase**: Progress from smoke → load → stress
|
|
291
|
+
3. **Environment Isolation**: Don't run stress tests on production
|
|
292
|
+
4. **Monitor Resources**: Watch application metrics during tests
|
|
293
|
+
5. **Baseline Establishment**: Track performance over time
|
|
294
|
+
6. **Threshold Tuning**: Adjust based on your SLAs
|
|
295
|
+
|
|
296
|
+
## Troubleshooting
|
|
297
|
+
|
|
298
|
+
### Common Issues
|
|
299
|
+
|
|
300
|
+
1. **Base URL not accessible**
|
|
301
|
+
- Ensure the deployment is complete
|
|
302
|
+
- Check URL is publicly accessible or provide auth headers
|
|
303
|
+
|
|
304
|
+
2. **Threshold failures**
|
|
305
|
+
- Review application performance
|
|
306
|
+
- Adjust thresholds if needed
|
|
307
|
+
- Check for resource constraints
|
|
308
|
+
|
|
309
|
+
3. **High error rates**
|
|
310
|
+
- Verify endpoint paths
|
|
311
|
+
- Check rate limiting
|
|
312
|
+
- Review application logs
|
|
313
|
+
|
|
314
|
+
### Debugging
|
|
315
|
+
|
|
316
|
+
Enable debug output:
|
|
317
|
+
|
|
318
|
+
```yaml
|
|
319
|
+
env:
|
|
320
|
+
K6_DEBUG: true
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## Examples
|
|
324
|
+
|
|
325
|
+
See the [examples directory](./examples/) for complete integration patterns.
|
|
326
|
+
|
|
327
|
+
## Additional Documentation
|
|
328
|
+
|
|
329
|
+
- [Integration Guide](./INTEGRATION_GUIDE.md) - Patterns for integrating k6 into your CI/CD pipeline
|
|
330
|
+
- [Scenario Selection Guide](./SCENARIO_SELECTION_GUIDE.md) - How to choose the right test scenario
|
|
331
|
+
- [Browser Testing Note](./BROWSER_TESTING_NOTE.md) - Future plans for browser testing support
|
|
332
|
+
|
|
333
|
+
## Architecture - Shared Implementation
|
|
334
|
+
|
|
335
|
+
The k6 setup uses a **shared implementation** that works identically in local development and CI/CD:
|
|
336
|
+
|
|
337
|
+
```
|
|
338
|
+
scripts/k6-run.sh # Unified runner script (entry point)
|
|
339
|
+
│
|
|
340
|
+
├── Local: k6 binary or Docker
|
|
341
|
+
└── CI/CD: GitHub Actions workflow
|
|
342
|
+
|
|
343
|
+
.github/k6/
|
|
344
|
+
├── scenarios/ # Test scenario implementations
|
|
345
|
+
│ ├── smoke.js # Shared between local & CI/CD
|
|
346
|
+
│ ├── load.js
|
|
347
|
+
│ ├── stress.js
|
|
348
|
+
│ ├── spike.js
|
|
349
|
+
│ └── soak.js
|
|
350
|
+
├── scripts/ # Reusable test scripts
|
|
351
|
+
│ ├── default-test.js
|
|
352
|
+
│ └── api-test.js
|
|
353
|
+
└── thresholds/ # Threshold configurations
|
|
354
|
+
├── strict.json
|
|
355
|
+
├── normal.json
|
|
356
|
+
└── relaxed.json
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Key Benefits
|
|
360
|
+
|
|
361
|
+
- **Single source of truth**: Same test scripts for local and CI/CD
|
|
362
|
+
- **Consistent results**: Identical test execution regardless of environment
|
|
363
|
+
- **Easy onboarding**: Developers can run the same tests CI/CD uses
|
|
364
|
+
- **Flexible execution**: Native k6, Docker, or k6 Cloud
|
|
365
|
+
|
|
366
|
+
### Environment Variables
|
|
367
|
+
|
|
368
|
+
Both local and CI/CD support the same environment variables:
|
|
369
|
+
|
|
370
|
+
| Variable | Description |
|
|
371
|
+
|----------|-------------|
|
|
372
|
+
| `K6_BASE_URL` | Target URL to test |
|
|
373
|
+
| `K6_SCENARIO` | Test scenario name |
|
|
374
|
+
| `K6_DURATION` | Override test duration |
|
|
375
|
+
| `K6_VUS` | Override virtual users |
|
|
376
|
+
| `K6_CUSTOM_HEADERS` | JSON string of custom headers |
|
|
377
|
+
| `K6_CLOUD_TOKEN` | k6 Cloud API token |
|
|
378
|
+
|
|
379
|
+
## Contributing
|
|
380
|
+
|
|
381
|
+
When adding new test scenarios:
|
|
382
|
+
|
|
383
|
+
1. Create the scenario in `scenarios/`
|
|
384
|
+
2. Update `default-test.js` with the new scenario
|
|
385
|
+
3. Document the scenario in this README
|
|
386
|
+
4. Add an example usage
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# K6 Test Scenario Selection Guide
|
|
2
|
+
|
|
3
|
+
This guide helps you choose the appropriate k6 test scenario for your needs.
|
|
4
|
+
|
|
5
|
+
## Quick Decision Tree
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Is this a post-deployment validation?
|
|
9
|
+
├─ YES → SMOKE TEST
|
|
10
|
+
└─ NO → Continue...
|
|
11
|
+
│
|
|
12
|
+
Is this for regular performance validation?
|
|
13
|
+
├─ YES → LOAD TEST
|
|
14
|
+
└─ NO → Continue...
|
|
15
|
+
│
|
|
16
|
+
Do you need to find breaking points?
|
|
17
|
+
├─ YES → STRESS TEST
|
|
18
|
+
└─ NO → Continue...
|
|
19
|
+
│
|
|
20
|
+
Is the concern about sudden traffic spikes?
|
|
21
|
+
├─ YES → SPIKE TEST
|
|
22
|
+
└─ NO → Continue...
|
|
23
|
+
│
|
|
24
|
+
Do you need to test for memory leaks or degradation?
|
|
25
|
+
├─ YES → SOAK TEST
|
|
26
|
+
└─ NO → SMOKE TEST (default)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Scenario Comparison
|
|
30
|
+
|
|
31
|
+
| Scenario | Duration | VUs | Use Case | Frequency |
|
|
32
|
+
|----------|----------|-----|----------|-----------|
|
|
33
|
+
| **Smoke** | 1-2 min | 1-5 | Basic functionality check | Every deployment |
|
|
34
|
+
| **Load** | 5-10 min | 10-100 | Normal traffic simulation | Daily/Weekly |
|
|
35
|
+
| **Stress** | 15-30 min | 100-500 | Find breaking points | Monthly/Before major releases |
|
|
36
|
+
| **Spike** | 5-10 min | 5→100→5 | Traffic surge handling | Before marketing campaigns |
|
|
37
|
+
| **Soak** | 30+ min | 10-50 | Long-term stability | Weekly/Monthly |
|
|
38
|
+
|
|
39
|
+
## Detailed Scenario Guidelines
|
|
40
|
+
|
|
41
|
+
### Smoke Test
|
|
42
|
+
**Choose when:**
|
|
43
|
+
- ✅ After every deployment
|
|
44
|
+
- ✅ Quick health check needed
|
|
45
|
+
- ✅ CI/CD pipeline validation
|
|
46
|
+
- ✅ Pre-production verification
|
|
47
|
+
|
|
48
|
+
**Avoid when:**
|
|
49
|
+
- ❌ Need performance metrics
|
|
50
|
+
- ❌ Testing scalability
|
|
51
|
+
- ❌ Looking for edge cases
|
|
52
|
+
|
|
53
|
+
**Configuration:**
|
|
54
|
+
```yaml
|
|
55
|
+
test_scenario: smoke
|
|
56
|
+
test_duration: 1m
|
|
57
|
+
virtual_users: 1
|
|
58
|
+
fail_on_threshold: true
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Load Test
|
|
62
|
+
**Choose when:**
|
|
63
|
+
- ✅ Measuring normal performance
|
|
64
|
+
- ✅ Establishing baselines
|
|
65
|
+
- ✅ SLA verification
|
|
66
|
+
- ✅ Capacity planning
|
|
67
|
+
|
|
68
|
+
**Avoid when:**
|
|
69
|
+
- ❌ Just need health check
|
|
70
|
+
- ❌ System is unstable
|
|
71
|
+
- ❌ During peak traffic
|
|
72
|
+
|
|
73
|
+
**Configuration:**
|
|
74
|
+
```yaml
|
|
75
|
+
test_scenario: load
|
|
76
|
+
test_duration: 10m
|
|
77
|
+
virtual_users: 50
|
|
78
|
+
fail_on_threshold: true
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Stress Test
|
|
82
|
+
**Choose when:**
|
|
83
|
+
- ✅ Finding system limits
|
|
84
|
+
- ✅ Capacity planning
|
|
85
|
+
- ✅ Before scaling decisions
|
|
86
|
+
- ✅ Architecture validation
|
|
87
|
+
|
|
88
|
+
**Avoid when:**
|
|
89
|
+
- ❌ In production environment
|
|
90
|
+
- ❌ System has known issues
|
|
91
|
+
- ❌ Limited test window
|
|
92
|
+
|
|
93
|
+
**Configuration:**
|
|
94
|
+
```yaml
|
|
95
|
+
test_scenario: stress
|
|
96
|
+
test_duration: 30m
|
|
97
|
+
fail_on_threshold: false # Expect some failures
|
|
98
|
+
upload_results: true # For detailed analysis
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Spike Test
|
|
102
|
+
**Choose when:**
|
|
103
|
+
- ✅ Before marketing campaigns
|
|
104
|
+
- ✅ Flash sale preparation
|
|
105
|
+
- ✅ Testing auto-scaling
|
|
106
|
+
- ✅ Validating circuit breakers
|
|
107
|
+
|
|
108
|
+
**Avoid when:**
|
|
109
|
+
- ❌ System doesn't auto-scale
|
|
110
|
+
- ❌ Traffic is always steady
|
|
111
|
+
- ❌ No surge protection needed
|
|
112
|
+
|
|
113
|
+
**Configuration:**
|
|
114
|
+
```yaml
|
|
115
|
+
test_scenario: spike
|
|
116
|
+
virtual_users: 100 # Peak spike size
|
|
117
|
+
fail_on_threshold: false
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Soak Test
|
|
121
|
+
**Choose when:**
|
|
122
|
+
- ✅ Detecting memory leaks
|
|
123
|
+
- ✅ Finding degradation issues
|
|
124
|
+
- ✅ Validating stability
|
|
125
|
+
- ✅ Before major releases
|
|
126
|
+
|
|
127
|
+
**Avoid when:**
|
|
128
|
+
- ❌ Quick feedback needed
|
|
129
|
+
- ❌ Limited test window
|
|
130
|
+
- ❌ System changes frequently
|
|
131
|
+
|
|
132
|
+
**Configuration:**
|
|
133
|
+
```yaml
|
|
134
|
+
test_scenario: soak
|
|
135
|
+
test_duration: 2h # Or longer
|
|
136
|
+
virtual_users: 20
|
|
137
|
+
fail_on_threshold: false
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Environment-Specific Recommendations
|
|
141
|
+
|
|
142
|
+
### Development Environment
|
|
143
|
+
```yaml
|
|
144
|
+
Primary: smoke
|
|
145
|
+
Secondary: load (reduced VUs)
|
|
146
|
+
Frequency: Every commit
|
|
147
|
+
Duration: 1-2 minutes max
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Staging Environment
|
|
151
|
+
```yaml
|
|
152
|
+
Primary: load
|
|
153
|
+
Secondary: stress, spike
|
|
154
|
+
Frequency: Daily load, weekly stress
|
|
155
|
+
Duration: 5-30 minutes
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Production Environment
|
|
159
|
+
```yaml
|
|
160
|
+
Primary: smoke
|
|
161
|
+
Secondary: load (off-peak only)
|
|
162
|
+
Frequency: Every deployment
|
|
163
|
+
Duration: 1-5 minutes max
|
|
164
|
+
Special: Monthly soak during maintenance windows
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Custom Scenario Combinations
|
|
168
|
+
|
|
169
|
+
### Pre-Release Validation
|
|
170
|
+
```yaml
|
|
171
|
+
1. smoke → Verify basic functionality
|
|
172
|
+
2. load → Check normal performance
|
|
173
|
+
3. spike → Test surge handling
|
|
174
|
+
4. stress → Find limits (staging only)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Performance Regression Testing
|
|
178
|
+
```yaml
|
|
179
|
+
1. load → Baseline measurement
|
|
180
|
+
2. Deploy changes
|
|
181
|
+
3. load → Compare results
|
|
182
|
+
4. Decision based on delta
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Incident Response
|
|
186
|
+
```yaml
|
|
187
|
+
1. smoke → Quick health check
|
|
188
|
+
2. load (reduced) → Gradual increase
|
|
189
|
+
3. Monitor and adjust
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Threshold Recommendations by Scenario
|
|
193
|
+
|
|
194
|
+
### Smoke Test Thresholds
|
|
195
|
+
- `http_req_failed`: < 1%
|
|
196
|
+
- `http_req_duration`: p(95) < 500ms
|
|
197
|
+
- `checks`: > 95%
|
|
198
|
+
|
|
199
|
+
### Load Test Thresholds
|
|
200
|
+
- `http_req_failed`: < 5%
|
|
201
|
+
- `http_req_duration`: p(95) < 1000ms
|
|
202
|
+
- `checks`: > 90%
|
|
203
|
+
|
|
204
|
+
### Stress Test Thresholds
|
|
205
|
+
- `http_req_failed`: < 10%
|
|
206
|
+
- `http_req_duration`: p(95) < 3000ms
|
|
207
|
+
- `checks`: > 80%
|
|
208
|
+
|
|
209
|
+
### Spike Test Thresholds
|
|
210
|
+
- `http_req_failed`: < 15%
|
|
211
|
+
- `http_req_duration`: p(95) < 5000ms
|
|
212
|
+
- Recovery time: < 2 minutes
|
|
213
|
+
|
|
214
|
+
### Soak Test Thresholds
|
|
215
|
+
- `http_req_failed`: < 2%
|
|
216
|
+
- `http_req_duration`: Stable (no degradation)
|
|
217
|
+
- Memory usage: Stable
|
|
218
|
+
- `checks`: > 95%
|
|
219
|
+
|
|
220
|
+
## Anti-Patterns to Avoid
|
|
221
|
+
|
|
222
|
+
1. **Running stress tests in production**
|
|
223
|
+
- Use staging or dedicated load test environment
|
|
224
|
+
|
|
225
|
+
2. **Using same thresholds for all scenarios**
|
|
226
|
+
- Each scenario has different expectations
|
|
227
|
+
|
|
228
|
+
3. **Running long tests in CI/CD**
|
|
229
|
+
- Keep CI/CD tests under 5 minutes
|
|
230
|
+
|
|
231
|
+
4. **Testing without baseline**
|
|
232
|
+
- Always establish baseline metrics first
|
|
233
|
+
|
|
234
|
+
5. **Ignoring environment differences**
|
|
235
|
+
- Adjust expectations per environment
|
|
236
|
+
|
|
237
|
+
## Progression Strategy
|
|
238
|
+
|
|
239
|
+
Start simple and build up:
|
|
240
|
+
|
|
241
|
+
1. **Week 1-2**: Smoke tests only
|
|
242
|
+
2. **Week 3-4**: Add load tests
|
|
243
|
+
3. **Month 2**: Introduce spike tests
|
|
244
|
+
4. **Month 3**: Add stress tests (staging)
|
|
245
|
+
5. **Ongoing**: Monthly soak tests
|
|
246
|
+
|
|
247
|
+
## Quick Reference
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
# Quick smoke test
|
|
251
|
+
test_scenario: smoke
|
|
252
|
+
|
|
253
|
+
# Standard performance test
|
|
254
|
+
test_scenario: load
|
|
255
|
+
|
|
256
|
+
# Find breaking points (staging only)
|
|
257
|
+
test_scenario: stress
|
|
258
|
+
|
|
259
|
+
# Test traffic spikes
|
|
260
|
+
test_scenario: spike
|
|
261
|
+
|
|
262
|
+
# Long-term stability
|
|
263
|
+
test_scenario: soak
|
|
264
|
+
```
|