Skip to content

Conversation

@skudasov
Copy link
Contributor

@skudasov skudasov commented Oct 31, 2025

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 wasp package, and updates documentation and dependencies across the project. The main themes are test generation tooling, package restructuring, and dependency maintenance.

Test Generation Tooling

  • Added a new CLI command gen load to generate load/chaos test templates for Kubernetes namespaces, including options for workload, naming, output directory, and latency/jitter configuration (framework/cmd/main.go).
  • Created documentation for the new test generation tool, describing its usage and best practices (book/src/framework/generate.md).
  • Updated the book summary to include the new "Generating Tests" section (book/src/SUMMARY.md).
  • Added a changelog entry for the chaos/load test codegen feature (framework/.changeset/v0.11.8.md).

Package Restructuring

  • Refactored chaos/load test logic from the havoc package to the new wasp/havoc package, updating imports and dependencies in example projects (framework/examples/myproject/chaos/chaos_k8s_test.go, framework/examples/myproject/go.mod). [1] [2] [3]
  • Removed havoc from the linter workflow job list (.github/workflows/linters.yml).

Dependency Maintenance

  • Updated multiple dependencies in framework/components/dockercompose/go.mod and framework/components/fake/go.mod to 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

  • Added .gitignore entries for new test output directories (framework/cmd/.gitignore).
  • Updated file permission notation in TOML pretty-printing logic (framework/cmd/main.go).

@skudasov skudasov requested a review from a team as a code owner October 31, 2025 12:36
@github-actions
Copy link

👋 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!

@sebawo sebawo requested a review from Copilot November 3, 2025 13:11
Copy link

Copilot AI left a 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 havoc package functionality into wasp package, removing the separate havoc module
  • Introduces CLI command ctf gen load for 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
Copy link
Contributor

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
Copy link
Contributor

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 {
Copy link
Contributor

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

Tofel
Tofel previously approved these changes Nov 3, 2025
@skudasov skudasov merged commit 41190d9 into main Nov 3, 2025
69 of 71 checks passed
@skudasov skudasov deleted the chaos-generator branch November 3, 2025 14:28
@skudasov
Copy link
Contributor Author

skudasov commented Nov 3, 2025

Dynamic Go mod version and TODO enforcer will be addressed in next PRs, good ideas 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants