You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some types of tests may require a lot of boilerplate and configurability, for example load and chaos tests.
3
+
Our code generation tools automatically build complete Chainlink environments and test templates, which minimizes documentation and provides a framework that is both structured and easily extensible.
4
4
5
-
We provide code generation tool that help you to start with best practes in such cases.
5
+
Let's read `help` first and then build an environment for a single EVM network:
6
+
```bash
7
+
ctf gen -h
8
+
# generate a new Chainlink environment in "devenv" directory with 4 Chainlink nodes and one EVM network. Generate CLI called "pcli" and enter the shell
All generators have `-h` or `--help` flag, please read the docs!
12
+
Follow further instructions in `devenv/README.md`
13
+
14
+
# Generating Infrastructure Testing Template
15
+
16
+
If you have Chainlink infrastructure already deployed it's useful to generate a workload + chaos suite template.
17
+
```bash
18
+
ctf gen load -h
19
+
# generate test suite named ChaosGen, with workload + default chaos experiments (fail + latency) for all the pods that have app.kubernetes.io/instance annotation
framework.L.Info().Msg("All cache files has been removed")
360
475
returnnil
361
476
}
477
+
478
+
// ensureJustInstalled checks if 'just' is available in PATH, and if not, attempts to install it.
479
+
// On macOS, it tries to install via Homebrew. On other platforms, it provides installation instructions.
480
+
funcensureJustInstalled() error {
481
+
// Check if just is already available
482
+
if_, err:=exec.LookPath("just"); err==nil {
483
+
returnnil
484
+
}
485
+
486
+
fmt.Println("⚠️ 'just' command not found in PATH")
487
+
fmt.Println("📦 Attempting to install 'just'...")
488
+
489
+
// Try to install via Homebrew on macOS
490
+
ifruntime.GOOS=="darwin" {
491
+
// Check if Homebrew is available
492
+
if_, err:=exec.LookPath("brew"); err==nil {
493
+
fmt.Println("🍺 Installing 'just' via Homebrew...")
494
+
cmd:=exec.Command("brew", "install", "just")
495
+
cmd.Stdout=os.Stdout
496
+
cmd.Stderr=os.Stderr
497
+
iferr:=cmd.Run(); err!=nil {
498
+
returnfmt.Errorf("failed to install 'just' via Homebrew: %w. Please install manually: brew install just", err)
499
+
}
500
+
fmt.Println("✅ Successfully installed 'just'")
501
+
returnnil
502
+
}
503
+
// Homebrew not available, provide instructions
504
+
returnfmt.Errorf("'just' is not installed and Homebrew is not available. Please install 'just' manually:\n brew install just\n Or visit: https://github.com/casey/just")
505
+
}
506
+
507
+
// For non-macOS platforms, provide installation instructions
508
+
returnfmt.Errorf("'just' is not installed. Please install it manually:\n Visit: https://github.com/casey/just\n Or use your package manager (e.g., apt install just, pacman -S just)")
0 commit comments