Skip to content

Commit ccdea2d

Browse files
committed
Merge branch 'main' into TT-1956-Add-support-for-E2E-docker-tests-in-Flakeguard
2 parents c52228d + 2497a60 commit ccdea2d

File tree

120 files changed

+71959
-2806
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+71959
-2806
lines changed

.github/workflows/framework-golden-tests.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ jobs:
2626
config: smoke_limited_resources.toml
2727
count: 1
2828
timeout: 10m
29-
- name: TestSuiSmoke
30-
config: smoke_sui.toml
31-
count: 1
32-
timeout: 10m
29+
# Sui client starts to flake and do not respond to healthcheck properly, need to be fixed
30+
# - name: TestSuiSmoke
31+
# config: smoke_sui.toml
32+
# count: 1
33+
# timeout: 10m
3334
- name: TestAptosSmoke
3435
config: smoke_aptos.toml
3536
count: 1
@@ -85,7 +86,7 @@ jobs:
8586
with:
8687
go-version: 1.23
8788
- name: Cache Go modules
88-
uses: actions/cache@v3
89+
uses: actions/cache@v4
8990
with:
9091
path: |
9192
~/.cache/go-build

.github/workflows/lint.yaml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,13 @@ jobs:
8282
- name: Check out Code
8383
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
8484
- name: Install Go
85-
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-go@d2f9642bcc24a73400568756f24b72c188ac7a9a # v2.3.31
85+
uses: smartcontractkit/.github/actions/setup-golang@3835daadbcefcae06d12dc42a405a856c980d2cc
8686
with:
87-
test_download_vendor_packages_command: cd ${{ matrix.project.path }} && go mod download
88-
go_mod_path: ${{ matrix.project.path }}go.mod
89-
cache_key_id: ctf-go-${{ matrix.project.name }}
90-
cache_restore_only: 'false'
87+
go-version-file: ${{ matrix.project.path }}go.mod
88+
use-go-cache: true
89+
go-cache-dep-path: ${{ matrix.project.path }}go.sum
9190
- name: golangci-lint ${{ needs.tools.outputs.golangci-lint-version }}
92-
uses: golangci/golangci-lint-action@9d1e0624a798bb64f6c3cea93db47765312263dc # v5.1.0
91+
uses: golangci/golangci-lint-action@051d91933864810ecd5e2ea2cfd98f6a5bca5347 # v6.3.2
9392
with:
9493
version: v${{ needs.tools.outputs.golangci-lint-version }}
9594
args: --out-format checkstyle:golangci-lint-report.xml
@@ -113,12 +112,11 @@ jobs:
113112
- name: Check out Code
114113
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
115114
- name: Install Go
116-
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-go@d2f9642bcc24a73400568756f24b72c188ac7a9a # v2.3.31
115+
uses: smartcontractkit/.github/actions/setup-golang@3835daadbcefcae06d12dc42a405a856c980d2cc
117116
with:
118-
test_download_vendor_packages_command: cd lib && go mod download
119-
go_mod_path: ./lib/go.mod
120-
cache_key_id: ctf-go
121-
cache_restore_only: 'false'
117+
go-version-file: ./lib/go.mod
118+
use-go-cache: true
119+
go-cache-dep-path: ./lib/go.sum
122120
- name: Write Go List
123121
working-directory: lib
124122
run: go list -json -deps ./... > ../go.list

.nancy-ignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ CVE-2023-42319 # CWE-noinfo: lol... go-ethereum v1.13.8 again
1414
CVE-2024-10086 # Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
1515
CVE-2024-51744 # CWE-755: Improper Handling of Exceptional Conditions
1616
CVE-2024-45338 # CWE-770: Allocation of Resources Without Limits or Throttling
17-
CVE-2024-45337 # CWE-863: Incorrect Authorization in golang.org/x/[email protected]
17+
CVE-2024-45337 # CWE-863: Incorrect Authorization in golang.org/x/[email protected]
18+
CVE-2025-24883 # CWE-248: Uncaught Exception

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @sebawo @smartcontractkit/test-tooling-team
1+
* @smartcontractkit/test-tooling-team

book/src/SUMMARY.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- [NodeSet (Local Docker builds)](./framework/nodeset_docker_rebuild.md)
1212
- [NodeSet Compat Environment](./framework/nodeset_compatibility.md)
1313
- [Creating your own components](./developing/developing_components.md)
14-
- [Fork Testing](./framework/fork.md)
14+
- [Asserting Logs](./developing/asserting_logs.md)
1515
- [Quick Contracts Deployment](./framework/quick_deployment.md)
1616
- [Verifying Contracts](./framework/verify.md)
1717
- [NodeSet with External Blockchain]()
@@ -20,6 +20,7 @@
2020
- [Test Configuration](./framework/test_configuration_overrides.md)
2121
- [Exposing Components](framework/components/state.md)
2222
- [Debugging Tests](framework/components/debug.md)
23+
- [Debugging K8s Chaos Tests](framework/chaos/debug-k8s.md)
2324
- [Components Cleanup](framework/components/cleanup.md)
2425
- [Components Caching](framework/components/caching.md)
2526
- [Components Resources](framework/components/resources.md)
@@ -54,7 +55,8 @@
5455
- [Testing Maturity Model](framework/testing.md)
5556
- [Smoke]()
5657
- [Performance]()
57-
- [Chaos]()
58+
- [Chaos](./framework/chaos/chaos.md)
59+
- [Fork Testing](./framework/fork.md)
5860
- [Interactive](framework/interactive.md)
5961
- [Libraries](./libraries.md)
6062
- [Seth](./libs/seth.md)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Asserting Container Logs
2+
3+
You can either assert that CL nodes have no errors like that, we check `(CRIT|PANIC|FATAL)` levels by default for all the nodes
4+
5+
```golang
6+
in, err := framework.Load[Cfg](t)
7+
require.NoError(t, err)
8+
t.Cleanup(func() {
9+
err := framework.SaveAndCheckLogs(t)
10+
require.NoError(t, err)
11+
})
12+
```
13+
14+
or customize file assertions
15+
16+
```golang
17+
in, err := framework.Load[Cfg](t)
18+
require.NoError(t, err)
19+
t.Cleanup(func() {
20+
// save all the logs to default directory "logs/docker-$test_name"
21+
logs, err := framework.SaveContainerLogs(fmt.Sprintf("%s-%s", framework.DefaultCTFLogsDir, t.Name()))
22+
require.NoError(t, err)
23+
// check that CL nodes has no errors (CRIT|PANIC|FATAL) levels
24+
err = framework.CheckCLNodeContainerErrors()
25+
require.NoError(t, err)
26+
// do custom assertions
27+
for _, l := range logs {
28+
matches, err := framework.SearchLogFile(l, " name=HeadReporter version=\\d")
29+
require.NoError(t, err)
30+
_ = matches
31+
}
32+
})
33+
```
34+
35+
Full [example](https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/framework/examples/myproject/smoke_logs_test.go)

book/src/framework/chaos/chaos.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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 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](https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/framework/examples/myproject/chaos/chaos_docker_test.go).
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](https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/framework/examples/myproject/chaos/chaos_k8s_test.go).
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](https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/framework/examples/myproject/chaos/chaos_blockchain_evm_gas_test.go) and [reorg](https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/framework/examples/myproject/chaos/chaos_blockchain_evm_reorg_test.go) examples.
60+
61+
## Debugging
62+
63+
To debug `Docker` applications you can just use `CTFv2` deployments.
64+
65+
To debug `K8s` please use our [simulator](../chaos/debug-k8s.md).
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Debugging K8s Chaos Tests
2+
3+
This deployment is used to debug various [ChaosMesh](https://chaos-mesh.org/) with [Kind](https://kind.sigs.k8s.io/)
4+
5+
Install [DevBox](https://www.jetify.com/devbox) and run your environment
6+
```
7+
cd infra/chaosmesh-playground
8+
devbox run up
9+
```
10+
11+
Check the services
12+
```
13+
devbox shell
14+
k9s
15+
```
16+
Apply experiments (inside devbox shell)
17+
18+
If you running it from any other shell or using `Go` don't forget to apply `kubectl config set-context kind-cm-playground` before!
19+
```
20+
kubectl apply -f manifests/latency.yaml
21+
```
22+
Debug `ChaosMesh` using `k9s`, check daemon logs.
23+
24+
Remove the environment
25+
```
26+
devbox run down
27+
```

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

0 commit comments

Comments
 (0)