Skip to content

Commit 01e050e

Browse files
committed
Merge branch 'main' of github.com:smartcontractkit/chainlink-testing-framework into dependabotUpdates
2 parents e77c474 + bc5f730 commit 01e050e

File tree

100 files changed

+5205
-2928
lines changed

Some content is hidden

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

100 files changed

+5205
-2928
lines changed

.github/workflows/docs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ on:
55
push:
66
branches:
77
- main
8+
tags:
9+
- '*'
810

911
jobs:
1012
build-deploy:
1113
runs-on: ubuntu-latest
1214
steps:
1315
- name: Checkout
1416
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
17+
with:
18+
fetch-depth: 0 # Fetch all history for all tags
1519

1620
- name: Setup mdBook
1721
uses: peaceiris/actions-mdbook@v2
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Framework Golden Tests Examples
2+
on:
3+
push:
4+
5+
jobs:
6+
test:
7+
defaults:
8+
run:
9+
working-directory: framework/examples/myproject
10+
env:
11+
LOKI_TENANT_ID: promtail
12+
LOKI_URL: http://localhost:3030/loki/api/v1/push
13+
runs-on: ubuntu-latest
14+
permissions:
15+
id-token: write
16+
contents: read
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
test:
21+
- name: TestSmoke
22+
config: smoke.toml
23+
count: 1
24+
timeout: 10m
25+
- name: TestLoad
26+
config: load.toml
27+
count: 1
28+
timeout: 10m
29+
- name: TestChaos
30+
config: chaos.toml
31+
count: 1
32+
timeout: 10m
33+
- name: TestReload
34+
config: reload.toml
35+
count: 1
36+
timeout: 10m
37+
steps:
38+
- name: Checkout repo
39+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
40+
- name: Configure AWS credentials using OIDC
41+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
42+
with:
43+
role-to-assume: ${{ secrets.PUBLIC_AWS_ECR_ROLE }}
44+
aws-region: us-east-1
45+
- name: Authenticate to ECR Public
46+
id: login-ecr-public
47+
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
48+
with:
49+
registry-type: public
50+
- name: Check for changes in Framework
51+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
52+
id: changes
53+
with:
54+
filters: |
55+
src:
56+
- 'framework/**'
57+
- name: Set up Go
58+
uses: actions/setup-go@v4
59+
with:
60+
go-version: 1.22.8
61+
- name: Cache Go modules
62+
uses: actions/cache@v3
63+
with:
64+
path: |
65+
~/.cache/go-build
66+
~/go/pkg/mod
67+
key: go-modules-${{ hashFiles('framework/examples/myproject/go.sum') }}-${{ runner.os }}-framework-golden-examples
68+
restore-keys: |
69+
go-modules-${{ runner.os }}-framework-golden-examples
70+
go-modules-${{ runner.os }}
71+
- name: Install dependencies
72+
run: go mod download
73+
- name: Run Docker Component Tests
74+
if: steps.changes.outputs.src == 'true'
75+
env:
76+
CTF_CONFIGS: ${{ matrix.test.config }}
77+
run: |
78+
go test -timeout ${{ matrix.test.timeout }} -v -count ${{ matrix.test.count }} -run ${{ matrix.test.name }}

.github/workflows/framework.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,22 @@ jobs:
1010
run:
1111
working-directory: framework
1212
runs-on: ubuntu-latest
13+
permissions:
14+
id-token: write
15+
contents: read
1316
steps:
1417
- name: Checkout repo
1518
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
19+
- name: Configure AWS credentials using OIDC
20+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
21+
with:
22+
role-to-assume: ${{ secrets.PUBLIC_AWS_ECR_ROLE }}
23+
aws-region: us-east-1
24+
- name: Authenticate to ECR Public
25+
id: login-ecr-public
26+
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
27+
with:
28+
registry-type: public
1629
- name: Check for changes in Framework
1730
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
1831
id: changes

.github/workflows/release-go-module.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@ jobs:
126126
else
127127
echo "CMD_ENTRYPOINT_EXISTS=false" >> "$GITHUB_ENV"
128128
fi
129+
- name: Set binary name based on PACKAGE_NAME
130+
run: |
131+
if [ "${{ env.PACKAGE_NAME }}" == "framework" ]; then
132+
echo "BINARY_NAME=ctf" >> $GITHUB_ENV
133+
else
134+
echo "BINARY_NAME=${{ env.PACKAGE_NAME }}" >> $GITHUB_ENV
135+
fi
129136
- name: Build binary release
130137
uses: wangyoucao577/go-release-action@v1
131138
if: env.CMD_ENTRYPOINT_EXISTS == 'true'
@@ -134,7 +141,7 @@ jobs:
134141
goversion: '1.22.6'
135142
goos: ${{ matrix.platform }}
136143
goarch: ${{ matrix.goarch }}
137-
binary_name: ${{ env.PACKAGE_NAME }}
144+
binary_name: ${{ env.BINARY_NAME }}
138145
release_name: ${{ env.PACKAGE_NAME }}
139146
release_tag: ${{ env.PACKAGE_NAME}}/${{ env.VERSION }}
140147
project_path: ${{ env.PACKAGE_NAME }}/cmd

.github/workflows/test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
path: ./tools/ghlatestreleasechecker/
2323
- name: asciitable
2424
path: ./tools/asciitable/
25+
- name: flakeguard
26+
path: ./tools/flakeguard/
2527
- name: workflowresultparser
2628
path: ./tools/workflowresultparser/
2729
runs-on: ubuntu-latest

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
[![Seth tag](https://img.shields.io/github/v/tag/smartcontractkit/chainlink-testing-framework?filter=%2Aseth%2A)](https://github.com/smartcontractkit/chainlink-testing-framework/tags)
1111
[![Havoc tag](https://img.shields.io/github/v/tag/smartcontractkit/chainlink-testing-framework?filter=%2Ahavoc%2A)](https://github.com/smartcontractkit/chainlink-testing-framework/tags)
1212

13-
![Tests](https://github.com/smartcontractkit/chainlink-testing-framework/actions/workflows/test.yaml/badge.svg)
14-
![Lint](https://github.com/smartcontractkit/chainlink-testing-framework/actions/workflows/lint.yaml/badge.svg)
13+
[![Tests](https://github.com/smartcontractkit/chainlink-testing-framework/actions/workflows/test.yaml/badge.svg)](https://github.com/smartcontractkit/chainlink-testing-framework/actions/workflows/test.yaml)
14+
[![Lints](https://github.com/smartcontractkit/chainlink-testing-framework/actions/workflows/lint.yaml/badge.svg)](https://github.com/smartcontractkit/chainlink-testing-framework/actions/workflows/lint.yaml)
1515

1616
[![Go Report Card](https://goreportcard.com/badge/github.com/smartcontractkit/chainlink-testing-framework)](https://goreportcard.com/report/github.com/smartcontractkit/chainlink-testing-framework)
1717
![Go Version](https://img.shields.io/github/go-mod/go-version/smartcontractkit/chainlink-testing-framework?filename=./lib/go.mod)

book/src/SUMMARY.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@
88
- [Connecting Chainlink Node (Multiple networks)]()
99
- [NodeSet Environment](./framework/nodeset_environment.md)
1010
- [NodeSet with Capabilities](./framework/nodeset_capabilities.md)
11-
- [NodeSet with External Blockchain](./framework/nodeset_external.md)
1211
- [NodeSet (Local Docker builds)](./framework/nodeset_docker_rebuild.md)
1312
- [NodeSet Compat Environment](./framework/nodeset_compatibility.md)
13+
- [NodeSet with External Blockchain]()
1414
- [CLI](./framework/cli.md)
1515
- [Configuration](./framework/configuration.md)
1616
- [Test Configuration](./framework/test_configuration_overrides.md)
17-
- [Caching](framework/components/caching.md)
17+
- [Components Persistence](framework/components/state.md)
18+
- [Components Caching](framework/components/caching.md)
1819
- [Secrets]()
20+
- [Docker](framework/docker.md)
1921
- [Observability Stack](framework/observability/observability_stack.md)
20-
- [Metrics]()
22+
- [Metrics](framework/observability/metrics.md)
2123
- [Logs](framework/observability/logs.md)
2224
- [Profiling](framework/observability/profiling.md)
2325
- [Traces]()
@@ -29,13 +31,18 @@
2931
- [Geth]()
3032
- [Optimism Stack]()
3133
- [Arbitrum Stack]()
32-
- [Chainlink]()
33-
- [Node]()
34-
- [NodeSet]()
34+
- [Chainlink](framework/components/chainlink.md)
35+
- [Node](framework/components/chainlink/node.md)
36+
- [NodeSet](framework/components/chainlink/nodeset.md)
3537
- [Clients]()
3638
- [Chainlink]()
3739
- [RPC]()
3840
- [Loki]()
41+
- [Testing]()
42+
- [Smoke]()
43+
- [Performance]()
44+
- [Chaos]()
45+
- [Interactive](framework/interactive.md)
3946
- [Continuous Integration](ci/ci.md)
4047
- [Libraries](./libraries.md)
4148
- [Seth](./libs/seth.md)

book/src/ci/ci.md

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,87 @@
22

33
Here we describe our good practices for structuring different types of tests in Continuous Integration (GitHub Actions).
44

5-
Follow [this](https://github.com/smartcontractkit/.github/tree/main/.github/workflows) guide.
5+
Set up secrets in your GitHub repository
6+
```
7+
gh secret set CTF_SIMULATED_KEY_1 --body "..."
8+
```
9+
10+
Add a workflow
11+
```yaml
12+
name: Framework Golden Tests Examples
13+
on:
14+
push:
15+
16+
jobs:
17+
test:
18+
defaults:
19+
run:
20+
working-directory: framework/examples/myproject
21+
env:
22+
LOKI_TENANT_ID: promtail
23+
LOKI_URL: http://localhost:3030/loki/api/v1/push
24+
runs-on: ubuntu-latest
25+
permissions:
26+
id-token: write
27+
contents: read
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
test:
32+
- name: TestSmoke
33+
config: smoke.toml
34+
count: 1
35+
timeout: 10m
36+
- name: TestLoad
37+
config: load.toml
38+
count: 1
39+
timeout: 10m
40+
- name: TestChaos
41+
config: chaos.toml
42+
count: 1
43+
timeout: 10m
44+
steps:
45+
- name: Checkout repo
46+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
47+
- name: Configure AWS credentials using OIDC
48+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
49+
with:
50+
role-to-assume: ${{ secrets.PUBLIC_AWS_ECR_ROLE }}
51+
aws-region: us-east-1
52+
- name: Authenticate to ECR Public
53+
id: login-ecr-public
54+
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
55+
with:
56+
registry-type: public
57+
- name: Check for changes in Framework
58+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
59+
id: changes
60+
with:
61+
filters: |
62+
src:
63+
- 'framework/**'
64+
- name: Set up Go
65+
uses: actions/setup-go@v4
66+
with:
67+
go-version: 1.22.8
68+
- name: Cache Go modules
69+
uses: actions/cache@v3
70+
with:
71+
path: |
72+
~/.cache/go-build
73+
~/go/pkg/mod
74+
key: go-modules-${{ hashFiles('framework/examples/myproject/go.sum') }}-${{ runner.os }}-framework-golden-examples
75+
restore-keys: |
76+
go-modules-${{ runner.os }}-framework-golden-examples
77+
go-modules-${{ runner.os }}
78+
- name: Install dependencies
79+
run: go mod download
80+
- name: Run Docker Component Tests
81+
if: steps.changes.outputs.src == 'true'
82+
env:
83+
CTF_CONFIGS: ${{ matrix.test.config }}
84+
run: |
85+
go test -timeout ${{ matrix.test.timeout }} -v -count ${{ matrix.test.count }} -run ${{ matrix.test.name }}
86+
```
87+
88+
If you need to structure a lot of different end-to-end tests follow [this](https://github.com/smartcontractkit/.github/tree/main/.github/workflows) guide.

book/src/framework/components/blockchains/anvil.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# Anvil command line params, ex.: docker_cmd_params = ['--block-time=1', '...']
1212
docker_cmd_params = []
1313
# Docker image and tag
14-
image = "ghcr.io/gakonst/foundry:latest"
14+
image = "f4hrenh9it/foundry:latest"
1515
# External port to expose
1616
port = "8545"
1717
# Pulls the image every time if set to 'true', used like that in CI. Can be set to 'false' to speed up local runs

book/src/framework/components/caching.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Component caching
22

3-
We use component caching to accelerate test development and enforce idempotent test actions.
3+
We use component caching to accelerate test development and enforce idempotent test actions development.
44

55
Each component is isolated by means of inputs and outputs.
66

0 commit comments

Comments
 (0)