-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
127 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Docker | ||
|
||
We are not removing volumes and images when you are working locally to allow you to debug, however, to clean up some space use: | ||
``` | ||
docker volume prune -f | ||
docker system prune -f | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
[blockchain_a] | ||
chain_id = "31337" | ||
image = "f4hrenh9it/foundry:latest" | ||
port = "8545" | ||
type = "anvil" | ||
|
||
[data_provider] | ||
port = 9111 | ||
|
||
[nodeset] | ||
nodes = 5 | ||
override_mode = "all" | ||
|
||
[[nodeset.node_specs]] | ||
|
||
[nodeset.node_specs.db] | ||
image = "postgres:15.6" | ||
pull_image = true | ||
|
||
[nodeset.node_specs.node] | ||
image = "public.ecr.aws/chainlink/chainlink:v2.17.0" | ||
pull_image = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package examples | ||
|
||
import ( | ||
"fmt" | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework" | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework/chaos" | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework/clclient" | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain" | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/fake" | ||
ns "github.com/smartcontractkit/chainlink-testing-framework/framework/components/simple_node_set" | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
"time" | ||
) | ||
|
||
type CfgReload struct { | ||
BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"` | ||
MockerDataProvider *fake.Input `toml:"data_provider" validate:"required"` | ||
NodeSet *ns.Input `toml:"nodeset" validate:"required"` | ||
} | ||
|
||
func TestReload(t *testing.T) { | ||
in, err := framework.Load[CfgReload](t) | ||
require.NoError(t, err) | ||
|
||
bc, err := blockchain.NewBlockchainNetwork(in.BlockchainA) | ||
require.NoError(t, err) | ||
dp, err := fake.NewFakeDataProvider(in.MockerDataProvider) | ||
require.NoError(t, err) | ||
|
||
// deploy first time | ||
out, err := ns.NewSharedDBNodeSet(in.NodeSet, bc, dp.BaseURLDocker) | ||
require.NoError(t, err) | ||
|
||
c, err := clclient.NewCLDefaultClients(out.CLNodes, framework.L) | ||
require.NoError(t, err) | ||
_, _, err = c[0].CreateJobRaw(` | ||
type = "cron" | ||
schemaVersion = 1 | ||
schedule = "CRON_TZ=UTC */10 * * * * *" # every 10 secs | ||
observationSource = """ | ||
// data source 2 | ||
fetch [type=http method=GET url="https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD"]; | ||
parse [type=jsonparse path="RAW,ETH,USD,PRICE"]; | ||
multiply [type="multiply" input="$(parse)" times=100] | ||
encode_tx [type="ethabiencode" | ||
abi="submit(uint256 value)" | ||
data="{ \\"value\\": $(multiply) }"] | ||
submit_tx [type="ethtx" to="0x859AAa51961284C94d970B47E82b8771942F1980" data="$(encode_tx)"] | ||
fetch -> parse -> multiply -> encode_tx -> submit_tx | ||
"""`) | ||
require.NoError(t, err) | ||
time.Sleep(20 * time.Second) | ||
|
||
// deploy second time | ||
_, err = chaos.ExecPumba("rm --volumes=false re2:node.*|postgresql.*") | ||
require.NoError(t, err) | ||
|
||
in.NodeSet.NodeSpecs[0].Node.UserConfigOverrides = in.NodeSet.NodeSpecs[0].Node.UserConfigOverrides + ` | ||
[Log] | ||
Level = 'info' | ||
` | ||
in.NodeSet.Out = nil | ||
out, err = ns.NewSharedDBNodeSet(in.NodeSet, bc, dp.BaseURLDocker) | ||
require.NoError(t, err) | ||
jobs, _, err := c[0].ReadJobs() | ||
require.NoError(t, err) | ||
fmt.Println(jobs) | ||
|
||
t.Run("test something", func(t *testing.T) { | ||
for _, n := range out.CLNodes { | ||
require.NotEmpty(t, n.Node.HostURL) | ||
require.NotEmpty(t, n.Node.HostP2PURL) | ||
} | ||
}) | ||
} |