Skip to content

Commit 76f0f13

Browse files
authored
multi-don examples (#1614)
multi-nodeset setup + chaos testing examples
1 parent 508c148 commit 76f0f13

39 files changed

+689
-267
lines changed

book/src/SUMMARY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
- [NodeSet Compat Environment](./framework/nodeset_compatibility.md)
1313
- [Creating your own components](./developing/developing_components.md)
1414
- [Asserting Logs](./developing/asserting_logs.md)
15-
- [Fork Testing](./framework/fork.md)
1615
- [Quick Contracts Deployment](./framework/quick_deployment.md)
1716
- [Verifying Contracts](./framework/verify.md)
1817
- [NodeSet with External Blockchain]()
@@ -55,7 +54,8 @@
5554
- [Testing Maturity Model](framework/testing.md)
5655
- [Smoke]()
5756
- [Performance]()
58-
- [Chaos]()
57+
- [Chaos](./framework/chaos/chaos.md)
58+
- [Fork Testing](./framework/fork.md)
5959
- [Interactive](framework/interactive.md)
6060
- [Libraries](./libraries.md)
6161
- [Seth](./libs/seth.md)

book/src/framework/chaos/chaos.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Chaos Testing
2+
3+
We offer Docker and Kubernetes boilerplates designed to test the resilience of `NodeSet` and `Blockchain`, which you can customize and integrate into your pipeline.
4+
5+
6+
## Goals
7+
8+
We recommend structuring your tests as a linear suite that applies various chaos experiments and verifies the outcomes using a [load](../../libs/wasp.md) testing suite. Focus on critical user metrics, such as:
9+
10+
- The ratio of successful responses to failed responses
11+
- The nth percentile of response latency
12+
13+
Next, evaluate observability:
14+
15+
- Ensure proper alerts are triggered during failures (manual or automated)
16+
- Verify the service recovers within the expected timeframe (manual or automated)
17+
18+
In summary, the **primary** focus is on meeting user expectations and maintaining SLAs, while the **secondary** focus is on observability and making operational part smoother.
19+
20+
21+
## Docker
22+
23+
For Docker, we utilize [Pumba](https://github.com/alexei-led/pumba) to conduct chaos experiments, including:
24+
25+
- Container reboots
26+
- Network simulations (such as delays, packet loss, corruption, etc., using the tc tool)
27+
- Stress testing for CPU and memory usage
28+
29+
Additionally, we offer a [resources](../../framework/components/resources.md) API that allows you to test whether your software can operate effectively in low-resource environments.
30+
31+
You can also use [fake](../../framework/components/mocking.md) package to create HTTP chaos experiments.
32+
33+
Given the complexity of `Kubernetes`, we recommend starting with `Docker` first. Identifying faulty behavior in your services early—such as cascading latency—can prevent more severe issues when scaling up. Addressing these problems at a smaller scale can save significant time and effort later.
34+
35+
Check `NodeSet` + `Blockchain` template [here]().
36+
37+
## Kubernetes
38+
39+
We utilize a subset of [ChaosMesh](https://chaos-mesh.org/) experiments that can be safely executed on an isolated node group. These include:
40+
41+
- [Pod faults](https://chaos-mesh.org/docs/simulate-pod-chaos-on-kubernetes/)
42+
43+
- [Network faults](https://chaos-mesh.org/docs/simulate-network-chaos-on-kubernetes/) – We focus on delay and partition experiments, as others may impact pods outside the dedicated node group.
44+
45+
- [HTTP faults](https://chaos-mesh.org/docs/simulate-http-chaos-on-kubernetes/)
46+
47+
Check `NodeSet` + `Blockchain` template [here]().
48+
49+
## Blockchain
50+
51+
We also offer a set of blockchain-specific experiments, which typically involve API calls to blockchain simulators to execute certain actions. These include:
52+
53+
- Adjusting gas prices
54+
55+
- Introducing chain reorganizations (setting a new head)
56+
57+
- Utilizing developer APIs (e.g., Anvil)
58+
59+
Check [gas]() and [reorg]() examples.

book/src/framework/components/chainlink/nodeset.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ This component requires some Blockchain to be deployed, add this to config
4242
Then configure NodeSet
4343
```toml
4444
[nodeset]
45+
# unique NodeSet name
46+
name = "don"
4547
# amount of Chainlink nodes to spin up
4648
nodes = 5
4749
# Override mode: can be "all" or "each"

book/src/framework/components/state.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ One node set is enough for any kind of testing, if you need more nodes consider
4444
You can also define a custom set of ports for any node.
4545
```toml
4646
[nodeset]
47+
name = "don"
4748
nodes = 5
4849
override_mode = "each"
4950

book/src/framework/nodeset_capabilities.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Create a configuration file `smoke.toml`
2121
docker_cmd_params = ["-b", "1"]
2222

2323
[nodeset]
24+
name = "don"
2425
nodes = 5
2526
override_mode = "all"
2627

book/src/framework/nodeset_compatibility.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Create a configuration file `smoke.toml`
99
docker_cmd_params = ["-b", "1"]
1010

1111
[nodeset]
12+
name = "don"
1213
nodes = 5
1314
override_mode = "each"
1415

book/src/framework/nodeset_docker_rebuild.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Create a configuration file `smoke.toml`
99
docker_cmd_params = ["-b", "1"]
1010

1111
[nodeset]
12+
name = "don"
1213
nodes = 5
1314
override_mode = "all"
1415

book/src/framework/nodeset_environment.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Create a configuration file `smoke.toml`
99
docker_cmd_params = ["-b", "1"]
1010

1111
[nodeset]
12+
name = "don"
1213
nodes = 5
1314
override_mode = "all"
1415

framework/.changeset/v0.5.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Allow multiple node sets simultaneously
2+
- Add chaos examples for gas, reorg, k8s and docker

framework/cmd/docker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func removeTestContainers() error {
1414
cmd := exec.Command("bash", "-c", `
1515
docker ps -aq --filter "label=framework=ctf" | xargs -r docker rm -f && \
1616
docker network ls --filter "label=framework=ctf" -q | xargs -r docker network rm && \
17-
docker volume rm postgresql_data || true
17+
docker volume ls -q | xargs -r docker volume rm || true
1818
`)
1919
framework.L.Debug().Msg("Running command")
2020
if framework.L.GetLevel() == zerolog.DebugLevel {

0 commit comments

Comments
 (0)