Skip to content

Commit 8f23a1b

Browse files
authored
Merge branch 'main' into TT-1715-Create-unit-tests-for-the-new-flaky-tests-detector
2 parents af3abf1 + d931474 commit 8f23a1b

File tree

19 files changed

+189
-129
lines changed

19 files changed

+189
-129
lines changed

.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

book/src/SUMMARY.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
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)
@@ -29,9 +29,9 @@
2929
- [Geth]()
3030
- [Optimism Stack]()
3131
- [Arbitrum Stack]()
32-
- [Chainlink]()
33-
- [Node]()
34-
- [NodeSet]()
32+
- [Chainlink](framework/components/chainlink.md)
33+
- [Node](framework/components/chainlink/node.md)
34+
- [NodeSet](framework/components/chainlink/nodeset.md)
3535
- [Clients]()
3636
- [Chainlink]()
3737
- [RPC]()

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
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Chainlink
2+
3+
Here we store `Chainlink` components: Node, NodeSet, JobDistributor and other services.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Node
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# NodeSet
2+
3+
## Configuration
4+
```toml
5+
[nodeset]
6+
# amount of Chainlink nodes to spin up
7+
nodes = 5
8+
# Override mode: can be "all" or "each"
9+
# defines how we override configs, either we apply first node fields to all of them
10+
# or we define each node custom configuration (used in compatibility testing)
11+
override_mode = "all"
12+
13+
[[nodeset.node_specs]]
14+
# Optional URL for fake data provider URL
15+
# usually set up in test with local mock server
16+
data_provider_url = ""
17+
18+
[nodeset.node_specs.db]
19+
# PostgreSQL image version and tag
20+
image = "postgres:15.6"
21+
# Pulls the image every time if set to 'true', used like that in CI. Can be set to 'false' to speed up local runs
22+
pull_image = true
23+
24+
[nodeset.node_specs.node]
25+
# A list of paths to capability binaries
26+
capabilities = ["./capability_1", "./capability_2"]
27+
# Default capabilities directory inside container
28+
capabilities_container_dir = "/home/capabilities"
29+
# Image to use, you can either provide "image" or "docker_file" + "docker_ctx" fields
30+
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
31+
# Path to your Chainlink Dockerfile
32+
docker_file = "../../core/chainlink.Dockerfile"
33+
# Path to docker context that should be used to build from
34+
docker_ctx = "../.."
35+
# Optional name for image we build, default is "ctftmp"
36+
docker_image_name = "ctftmp"
37+
# Pulls the image every time if set to 'true', used like that in CI. Can be set to 'false' to speed up local runs
38+
pull_image = true
39+
# Overrides Chainlink node TOML configuration
40+
# can be multiline, see example
41+
user_config_overrides = """
42+
[Log]
43+
level = 'info'
44+
"""
45+
# Overrides Chainlink node secrets TOML configuration
46+
# you can only add fields, overriding existing fields is prohibited by Chainlink node
47+
user_secrets_overrides = """
48+
[AnotherSecret]
49+
mySecret = 'a'
50+
"""
51+
52+
# Outputs are the results of deploying a component that can be used by another component
53+
[nodeset.out]
54+
# If 'use_cache' equals 'true' we skip component setup when we run the test and return the outputs
55+
use_cache = true
56+
57+
# Describes deployed or external Chainlink nodes
58+
[[nodeset.out.cl_nodes]]
59+
use_cache = true
60+
61+
# Describes deployed or external Chainlink node
62+
[nodeset.out.cl_nodes.node]
63+
# Host Docker URLs the test uses
64+
# in case of using external component you can replace these URLs with another deployment
65+
p2p_url = "http://127.0.0.1:32996"
66+
url = "http://127.0.0.1:33096"
67+
# Describes PostgreSQL instance
68+
[nodeset.out.cl_nodes.postgresql]
69+
# PostgreSQL connection string
70+
# in case of using external database can be overriden
71+
url = "postgresql://chainlink:[email protected]:33094/chainlink?sslmode=disable"
72+
73+
# Can have more than one node, fields are the same, see above ^^
74+
[[nodeset.out.cl_nodes]]
75+
[nodeset.out.cl_nodes.node]
76+
[nodeset.out.cl_nodes.postgresql]
77+
...
78+
```
79+
80+
## Usage
81+
```golang
82+
package yourpackage_test
83+
84+
import (
85+
"fmt"
86+
"github.com/smartcontractkit/chainlink-testing-framework/framework"
87+
ns "github.com/smartcontractkit/chainlink-testing-framework/framework/components/simple_node_set"
88+
"github.com/stretchr/testify/require"
89+
"testing"
90+
)
91+
92+
type Config struct {
93+
NodeSet *ns.Input `toml:"nodeset" validate:"required"`
94+
}
95+
96+
func TestNodeSet(t *testing.T) {
97+
in, err := framework.Load[Config](t)
98+
require.NoError(t, err)
99+
100+
out, err := ns.NewSharedDBNodeSet(in.NodeSet, bc, dp.BaseURLDocker)
101+
require.NoError(t, err)
102+
103+
...
104+
}
105+
```

book/src/framework/connecting_chainlink_node.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Create your configuration in `smoke.toml`
66
```toml
77
[blockchain_a]
88
chain_id = "31337"
9-
image = "ghcr.io/gakonst/foundry:latest"
9+
image = "f4hrenh9it/foundry:latest"
1010
port = "8545"
1111
type = "anvil"
1212

book/src/framework/first_test.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Create your configuration in `smoke.toml`
88
```toml
99
[blockchain_a]
1010
chain_id = "31337"
11-
image = "ghcr.io/gakonst/foundry:latest"
11+
image = "f4hrenh9it/foundry:latest"
1212
port = "8545"
1313
type = "anvil"
1414
```
@@ -41,9 +41,14 @@ func TestMe(t *testing.T) {
4141
}
4242
```
4343

44-
Select your configuration by setting `CTF_CONFIGS=smoke.toml` and run it
44+
Run the test
4545
```bash
46-
go test -v -run TestMe
46+
CTF_CONFIGS=smoke.toml go test -v -run TestMe
47+
```
48+
49+
Remove containers
50+
```
51+
ctf d rm
4752
```
4853

4954
Summary:

book/src/framework/getting_started.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Getting started
1+
# 🚀 Getting started
22

33
## Prerequisites
4-
- `Docker` ([OrbStack](https://orbstack.dev/) or [Docker Desktop](https://www.docker.com/products/docker-desktop/))
4+
- `Docker` [OrbStack](https://orbstack.dev/) or [Docker Desktop](https://www.docker.com/products/docker-desktop/), we recommend OrbStack (faster, smaller memory footprint)
55
- [Golang](https://go.dev/doc/install)
66

77
## Test setup
@@ -11,18 +11,19 @@ To start writing tests create a directory for your project with `go.mod` and pul
1111
go get github.com/smartcontractkit/chainlink-testing-framework/framework
1212
```
1313

14-
Then download the CLI (runs from directory where you have `go.mod`)
14+
Then download the CLI (runs from the directory where you have `go.mod`)
1515
```
1616
go get github.com/smartcontractkit/chainlink-testing-framework/framework/cmd && \
1717
go install github.com/smartcontractkit/chainlink-testing-framework/framework/cmd && \
1818
mv ~/go/bin/cmd ~/go/bin/ctf
1919
```
20+
Or download a binary release [here](https://github.com/smartcontractkit/chainlink-testing-framework/releases/tag/framework%2Fv0.1.7) and rename it to `ctf`
21+
2022
More CLI [docs](./cli.md)
2123

22-
Create an `.envrc` file and put common parameters there (you can use [direnv](https://direnv.net/) to sync them more easily)
24+
Create an `.envrc` file and do `source .envrc`
2325
```
2426
export TESTCONTAINERS_RYUK_DISABLED=true # do not remove containers while we develop locally
25-
export CTF_CONFIGS=smoke.toml # our configuration file
2627
```
2728

2829
Now you are ready to write your [first test](./first_test.md)
@@ -35,8 +36,10 @@ Spin up your local obserability stack (Grafana LGTM)
3536
```
3637
ctf obs up
3738
```
39+
More [docs](observability/observability_stack.md)
3840

3941
Spin up your `Blockscout` stack
4042
```
4143
ctf bs up
4244
```
45+
More [docs](observability/blockscout.md)

book/src/framework/interactive.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ If you're on OS X, we recommend to use [OrbStack](https://orbstack.dev/).
99

1010
For other platforms use [Docker Desktop](https://www.docker.com/products/docker-desktop/).
1111

12-
Download the latest CLI [here](https://github.com/smartcontractkit/chainlink-testing-framework/releases/tag/framework%2Fv0.1.6)
12+
Download the latest CLI [here](https://github.com/smartcontractkit/chainlink-testing-framework/releases/tag/framework%2Fv0.1.7)
1313

1414
Allow it to run in `System Settings -> Security Settings` (OS X)
1515

0 commit comments

Comments
 (0)