Skip to content

Commit 66c44e2

Browse files
committed
update readme
1 parent 03aa08b commit 66c44e2

File tree

6 files changed

+54
-30
lines changed

6 files changed

+54
-30
lines changed

framework/examples/myproject_cll/README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,24 @@ Checkout Job Distributor repository and build an image
99
docker build -t job-distributor:0.9.0 -f e2e/Dockerfile.e2e .
1010
```
1111

12-
Run the tests locally
13-
```
14-
CTF_CONFIGS=jd.toml go test -v -run TestJD
15-
```
12+
## Test Environment Setup
13+
14+
Test environment includes:
15+
- `Anvil` blockchain
16+
- NodeSet with 5 nodes
17+
- JobDistributor
18+
- `gin` mockserver for fakes
1619

17-
## Job Distributor from staging dump
18-
Get `.sql` dump from staging or production service and then run
20+
This setup allows you to also set chain fork, see [config](jd_nodeset.toml), change `docker_cmd_params`.
21+
22+
You can also load JobDistributor database dump using [config](jd_nodeset.toml), see `jd_sql_dump_path` field
23+
24+
Run the tests locally
1925
```
20-
CTF_CONFIGS=jd_dump.toml go test -v run TestJD
26+
CTF_CONFIGS=jd_nodeset.toml go test -v -run TestJDNodeSet
2127
```
2228

23-
## Connect to the database
29+
## Connect to the JD database
2430
```
2531
PGPASSWORD=thispasswordislongenough psql -h 0.0.0.0 -p 14000 -U chainlink -d job-distributor-db
2632
```

framework/examples/myproject_cll/jd.toml

Lines changed: 0 additions & 7 deletions
This file was deleted.

framework/examples/myproject_cll/jd_dump.toml

Lines changed: 0 additions & 8 deletions
This file was deleted.

framework/examples/myproject_cll/jd_nodeset.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
chain_id = "1337"
44
# uncomment to fork the chain
55
# docker_cmd_params = ["--fork-url", "wss://avalanche-fuji-c-chain-rpc.publicnode.com", "--auto-impersonate", "-b", "1"]
6-
docker_cmd_params = ["-b", "1"]
76
type = "anvil"
87

98
[data_provider]

framework/examples/myproject_cll/jd_nodeset_test.go

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package examples
22

33
import (
44
"testing"
5+
"time"
56

67
"github.com/stretchr/testify/require"
78

@@ -11,6 +12,7 @@ import (
1112
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/fake"
1213
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/jd"
1314
ns "github.com/smartcontractkit/chainlink-testing-framework/framework/components/simple_node_set"
15+
"github.com/smartcontractkit/chainlink-testing-framework/framework/rpc"
1416
)
1517

1618
type CfgJDNodeSet struct {
@@ -26,17 +28,49 @@ func TestJDNodeSet(t *testing.T) {
2628

2729
blockchainInfo, err := blockchain.NewBlockchainNetwork(in.Blockchains[0])
2830
require.NoError(t, err)
29-
_, err = fake.NewFakeDataProvider(in.MockedDataProvider)
31+
32+
// by default, nodeset is connected to the first Anvil but if you need more chains you can do it like that
33+
// srcNetworkCfg, err := clnode.NewNetworkCfg(&clnode.EVMNetworkConfig{
34+
// MinIncomingConfirmations: 1,
35+
// MinContractPayment: "0.00001 link",
36+
// ChainID: bcSrc.ChainID,
37+
// EVMNodes: []*clnode.EVMNode{
38+
// {
39+
// SendOnly: false,
40+
// Order: 100,
41+
// },
42+
// },
43+
// }, bcSrc)
44+
// in.NodeSets[0].NodeSpecs[0].Node.TestConfigOverrides = srcNetworkCfg
45+
46+
jobDistributorInfo, err := jd.NewJD(in.JD)
3047
require.NoError(t, err)
48+
49+
// connect JD with NodeSet
50+
3151
nodeSetInfo, err := ns.NewSharedDBNodeSet(in.NodeSets[0], blockchainInfo)
3252
require.NoError(t, err)
53+
_, err = fake.NewFakeDataProvider(in.MockedDataProvider)
54+
require.NoError(t, err)
3355

34-
jobDistributorInfo, err := jd.NewJD(in.JD)
56+
// set up your contracts here with 0s blocks, control the mining speed later
57+
58+
miner := rpc.NewRemoteAnvilMiner(blockchainInfo.Nodes[0].ExternalHTTPUrl, nil)
59+
miner.MinePeriodically(1 * time.Second)
60+
clClients, err := clclient.New(nodeSetInfo.CLNodes)
3561
require.NoError(t, err)
3662

37-
t.Run("test changesets with forked network/JD state", func(t *testing.T) {
38-
clClients, err := clclient.New(nodeSetInfo.CLNodes)
39-
require.NoError(t, err)
63+
t.Run("test #1", func(t *testing.T) {
64+
_ = clClients
65+
// create some jobs
66+
//_, _, err = c[0].CreateJobRaw()
67+
//require.NoError(t, err)
68+
_ = nodeSetInfo
69+
_ = blockchainInfo
70+
_ = jobDistributorInfo
71+
})
72+
73+
t.Run("test #2", func(t *testing.T) {
4074
_ = clClients
4175
// create some jobs
4276
//_, _, err = c[0].CreateJobRaw()

wasp/examples/simple_rps/gun.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func (m *ExampleGun) Call(l *wasp.Generator) *wasp.Response {
3030
return &wasp.Response{Data: result, Error: err.Error()}
3131
}
3232
if r.Status() != "200 OK" {
33-
return &wasp.Response{Data: result, Error: "not 200"}
33+
return &wasp.Response{Data: result, Error: "not 200", Failed: true}
3434
}
3535
return &wasp.Response{Data: result}
3636
}

0 commit comments

Comments
 (0)