Skip to content

Commit 4733cca

Browse files
committed
docs refactor and fake service
1 parent 1c31ae7 commit 4733cca

File tree

17 files changed

+217
-160
lines changed

17 files changed

+217
-160
lines changed

book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- [Exposing Components](framework/components/state.md)
1818
- [Components Cleanup](framework/components/cleanup.md)
1919
- [Components Caching](framework/components/caching.md)
20+
- [Mocking Services](framework/components/mocking.md)
2021
- [External Environment](framework/components/external.md)
2122
- [Secrets]()
2223
- [Observability Stack](framework/observability/observability_stack.md)

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@ Here we provide full configuration reference, if you want to copy and run it, pl
1010
## Configuration
1111
```toml
1212
[cl_node]
13-
# Optional URL for fake data provider URL
14-
# usually set up in test with local mock server
15-
data_provider_url = "http://example.com"
1613

1714
[cl_node.db]
1815
# PostgreSQL image version and tag
1916
image = "postgres:15.6"
2017
# Pulls the image every time if set to 'true', used like that in CI. Can be set to 'false' to speed up local runs
21-
pull_image = true
18+
pull_image = false
2219

2320
[cl_node.node]
2421
# custom ports that plugins may need to expose and map to the host machine
@@ -36,7 +33,7 @@ Here we provide full configuration reference, if you want to copy and run it, pl
3633
# Optional name for image we build, default is "ctftmp"
3734
docker_image_name = "ctftmp"
3835
# Pulls the image every time if set to 'true', used like that in CI. Can be set to 'false' to speed up local runs
39-
pull_image = true
36+
pull_image = false
4037
# Overrides Chainlink node TOML configuration
4138
# can be multiline, see example
4239
user_config_overrides = """

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

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,16 @@ Then configure NodeSet
5252
http_port_range_start = 10000
5353
# P2P API port range start, each new node get port incremented (host machine)
5454
p2p_port_range_start = 12000
55-
55+
56+
[nodeset.db]
57+
# PostgreSQL image version and tag
58+
image = "postgres:15.6"
59+
# Pulls the image every time if set to 'true', used like that in CI. Can be set to 'false' to speed up local runs
60+
pull_image = false
61+
# PostgreSQL volume name
62+
volume_name = ""
5663

5764
[[nodeset.node_specs]]
58-
# Optional URL for fake data provider URL
59-
# usually set up in test with local mock server
60-
data_provider_url = "http://example.com"
61-
62-
[nodeset.node_specs.db]
63-
# PostgreSQL image version and tag
64-
image = "postgres:15.6"
65-
# Pulls the image every time if set to 'true', used like that in CI. Can be set to 'false' to speed up local runs
66-
pull_image = true
67-
# PostgreSQL volume name
68-
volume_name = ""
6965

7066
[nodeset.node_specs.node]
7167
# custom ports that plugins may need to expose and map to the host machine
@@ -83,7 +79,7 @@ Then configure NodeSet
8379
# Optional name for image we build, default is "ctftmp"
8480
docker_image_name = "ctftmp"
8581
# Pulls the image every time if set to 'true', used like that in CI. Can be set to 'false' to speed up local runs
86-
pull_image = true
82+
pull_image = false
8783
# Overrides Chainlink node TOML configuration
8884
# can be multiline, see example
8985
user_config_overrides = """
@@ -136,15 +132,13 @@ package capabilities_test
136132
import (
137133
"github.com/smartcontractkit/chainlink-testing-framework/framework"
138134
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"
139-
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/fake"
140135
ns "github.com/smartcontractkit/chainlink-testing-framework/framework/components/simple_node_set"
141136
"github.com/stretchr/testify/require"
142137
"testing"
143138
)
144139

145140
type Config struct {
146141
BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"`
147-
MockerDataProvider *fake.Input `toml:"data_provider" validate:"required"`
148142
NodeSet *ns.Input `toml:"nodeset" validate:"required"`
149143
}
150144

@@ -154,9 +148,7 @@ func TestMe(t *testing.T) {
154148

155149
bc, err := blockchain.NewBlockchainNetwork(in.BlockchainA)
156150
require.NoError(t, err)
157-
dp, err := fake.NewFakeDataProvider(in.MockerDataProvider)
158-
require.NoError(t, err)
159-
out, err := ns.NewSharedDBNodeSet(in.NodeSet, bc, dp.BaseURLDocker)
151+
out, err := ns.NewSharedDBNodeSet(in.NodeSet, bc)
160152
require.NoError(t, err)
161153

162154
t.Run("test something", func(t *testing.T) {

book/src/framework/components/external.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,10 @@ For example, to integrate with remote `k8s` environment you can use `CTF_CONFIGS
2020
http_url = "http://127.0.0.1:8545"
2121
ws_url = "ws://127.0.0.1:8545"
2222

23-
[contracts]
24-
25-
[contracts.out]
26-
# set up your contracts
27-
addresses = ["0x5fbdb2315678afecb367f032d93f642f64180aa3"]
28-
use_cache = true
29-
30-
[data_provider]
31-
port = 9111
32-
33-
[data_provider.out]
34-
# setup your data provider URLs
35-
base_url_host = "http://localhost:9111"
36-
3723
[nodeset]
3824

3925
[[nodeset.node_specs]]
26+
...
4027

4128
[nodeset.out]
4229
use_cache = true
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Mocking Services
2+
3+
The framework aims to equip you with all the necessary tools to write end-to-end system-level tests, while still allowing the flexibility to mock third-party services that are not critical to your testing scope.
4+
5+
## Configuration
6+
```toml
7+
[fake]
8+
# port to start Gin server
9+
port = 9111
10+
```
11+
12+
## Usage
13+

book/src/framework/components/state.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,14 @@ You can also define a custom set of ports for any node
4444
[nodeset]
4545
nodes = 5
4646
override_mode = "each"
47+
48+
[nodeset.db]
49+
image = "postgres:15.6"
4750

4851
[[nodeset.node_specs]]
4952

50-
[nodeset.node_specs.db]
51-
image = "postgres:15.6"
52-
pull_image = true
53-
5453
[nodeset.node_specs.node]
5554
# here we defined 2 new ports to listen and mapped them to our host machine
5655
custom_ports = [14000, 14001]
5756
image = "public.ecr.aws/chainlink/chainlink:v2.16.0"
58-
pull_image = false
5957
```

book/src/framework/connecting_chainlink_node.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,12 @@ Create your configuration in `smoke.toml`
1111
type = "anvil"
1212

1313
[cl_node]
14-
data_provider_url = "http://example.com"
1514

1615
[cl_node.db]
1716
image = "postgres:15.6"
18-
pull_image = true
1917

2018
[cl_node.node]
2119
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
22-
pull_image = true
2320
```
2421

2522
Create your test in `smoke_test.go`

book/src/framework/nodeset_capabilities.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,21 @@ Create a configuration file `smoke.toml`
2222
port = "8545"
2323
type = "anvil"
2424

25-
[data_provider]
26-
port = 9111
27-
2825
[nodeset]
2926
nodes = 5
3027
override_mode = "all"
28+
29+
[nodeset.db]
30+
image = "postgres:15.6"
3131

3232
[[nodeset.node_specs]]
3333

34-
[nodeset.node_specs.db]
35-
image = "postgres:15.6"
36-
pull_image = true
37-
3834
[nodeset.node_specs.node]
3935
# path to your capability binaries
4036
capabilities = ["./kvstore"]
4137
# default capabilities directory
4238
# capabilities_container_dir = "/home/capabilities"
4339
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
44-
pull_image = true
45-
4640
```
4741

4842
Run it

book/src/framework/nodeset_compatibility.md

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,70 +10,45 @@ Create a configuration file `smoke.toml`
1010
port = "8545"
1111
type = "anvil"
1212

13-
[data_provider]
14-
port = 9111
15-
1613
[nodeset]
1714
nodes = 5
1815
override_mode = "each"
1916

20-
[[nodeset.node_specs]]
17+
[nodeset.db]
18+
image = "postgres:15.6"
2119

22-
[nodeset.node_specs.db]
23-
image = "postgres:15.6"
24-
pull_image = true
20+
[[nodeset.node_specs]]
2521

2622
[nodeset.node_specs.node]
2723
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
28-
pull_image = true
2924
user_config_overrides = " [Log]\n level = 'info'\n "
3025
user_secrets_overrides = ""
3126

3227
[[nodeset.node_specs]]
3328

34-
[nodeset.node_specs.db]
35-
image = "postgres:15.6"
36-
pull_image = true
37-
3829
[nodeset.node_specs.node]
3930
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
40-
pull_image = true
4131
user_config_overrides = " [Log]\n level = 'info'\n "
4232
user_secrets_overrides = ""
4333

4434
[[nodeset.node_specs]]
4535

46-
[nodeset.node_specs.db]
47-
image = "postgres:15.6"
48-
pull_image = true
49-
5036
[nodeset.node_specs.node]
5137
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
52-
pull_image = true
5338
user_config_overrides = " [Log]\n level = 'info'\n "
5439
user_secrets_overrides = ""
5540

5641
[[nodeset.node_specs]]
5742

58-
[nodeset.node_specs.db]
59-
image = "postgres:15.6"
60-
pull_image = true
61-
6243
[nodeset.node_specs.node]
6344
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
64-
pull_image = true
6545
user_config_overrides = " [Log]\n level = 'info'\n "
6646
user_secrets_overrides = ""
6747

6848
[[nodeset.node_specs]]
6949

70-
[nodeset.node_specs.db]
71-
image = "postgres:15.6"
72-
pull_image = true
73-
7450
[nodeset.node_specs.node]
7551
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
76-
pull_image = true
7752
user_config_overrides = " [Log]\n level = 'info'\n "
7853
user_secrets_overrides = ""
7954
```

book/src/framework/nodeset_docker_rebuild.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,18 @@ Create a configuration file `smoke.toml`
1010
port = "8545"
1111
type = "anvil"
1212

13-
[data_provider]
14-
port = 9111
15-
1613
[nodeset]
1714
nodes = 5
1815
override_mode = "all"
16+
17+
[nodeset.db]
18+
image = "postgres:15.6"
1919

2020
[[nodeset.node_specs]]
2121

22-
[nodeset.node_specs.db]
23-
image = "postgres:15.6"
24-
pull_image = true
25-
2622
[nodeset.node_specs.node]
2723
docker_file = "../../core/chainlink.Dockerfile"
2824
docker_ctx = "../.."
29-
pull_image = true
3025
```
3126

3227
These paths will work for `e2e/capabilities` in our main [repository](https://github.com/smartcontractkit/chainlink/tree/ctf-v2-tests/e2e/capabilities)

0 commit comments

Comments
 (0)