-
Notifications
You must be signed in to change notification settings - Fork 42
Load/Chaos codegen #2218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load/Chaos codegen #2218
Conversation
|
👋 skudasov, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces load and chaos test code generation capabilities for Kubernetes namespaces, moving functionality from the havoc package into wasp and adding CLI-based test template generation.
Key changes:
- Adds code generation for Kubernetes load/chaos tests that can scan namespaces and generate boilerplate test files
- Consolidates
havocpackage functionality intowasppackage, removing the separatehavocmodule - Introduces CLI command
ctf gen loadfor generating test templates with configurable options
Reviewed Changes
Copilot reviewed 41 out of 53 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| wasp/tmpl_generator.go | New code generator for load/chaos tests with K8s integration and template rendering |
| wasp/tmpl_generator_test.go | Comprehensive test suite for the template generator functionality |
| wasp/loki_client.go | Adds LocalCTFObsConfig function for local observability stack configuration |
| wasp/havoc/*.go | Package rename from havoc to wasp across all chaos-related files |
| framework/cmd/main.go | New CLI command for generating load test templates |
| Multiple go.mod files | Package updates and dependency management changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const ( | ||
| GoModTemplate = `module {{.ModuleName}} | ||
|
|
||
| go 1.25 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idea: use whatever go version the system is currently using?
| // TODO: choose each experiment duration | ||
| ExperimentDuration: "10s", | ||
| ExperimentInjectionDuration: "5s", | ||
| // TODO: whether to remove the chaos instance CRDs or not, useful for debugging in corner cases where logs can't help |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODOs are way to point the user to where he should look, but maybe a better way would be making sure that these lines do not compile and need to be fixed?
| // first generate all small pieces then insert into a table test template | ||
| func (g *LoadTestCodegen) GenerateTableTest() (string, error) { | ||
| gunCode, workloadCode := "", "" | ||
| if g.cfg.includeWorkload { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worry that it won't be obvious that this bool includeWorkload also controls generation of the gunCode
|
Dynamic Go mod version and TODO enforcer will be addressed in next PRs, good ideas 🚀 |
This pull request introduces a new code generation tool for chaos and load test templates, refactors the handling of chaos/load test logic into the
wasppackage, and updates documentation and dependencies across the project. The main themes are test generation tooling, package restructuring, and dependency maintenance.Test Generation Tooling
gen loadto generate load/chaos test templates for Kubernetes namespaces, including options for workload, naming, output directory, and latency/jitter configuration (framework/cmd/main.go).book/src/framework/generate.md).book/src/SUMMARY.md).framework/.changeset/v0.11.8.md).Package Restructuring
havocpackage to the newwasp/havocpackage, updating imports and dependencies in example projects (framework/examples/myproject/chaos/chaos_k8s_test.go,framework/examples/myproject/go.mod). [1] [2] [3]havocfrom the linter workflow job list (.github/workflows/linters.yml).Dependency Maintenance
framework/components/dockercompose/go.modandframework/components/fake/go.modto their latest versions, including Kubernetes, OpenTelemetry, and several others for improved compatibility and security. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]Miscellaneous
.gitignoreentries for new test output directories (framework/cmd/.gitignore).framework/cmd/main.go).