-
Notifications
You must be signed in to change notification settings - Fork 40
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
233 additions
and
52 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 |
---|---|---|
@@ -1,8 +1,20 @@ | ||
package simple_node_set | ||
|
||
// UpdateNodeConfigs updates nodes configuration TOML files | ||
import ( | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework/chaos" | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain" | ||
"time" | ||
) | ||
|
||
// UpgradeNodeSet updates nodes configuration TOML files | ||
// this API is discouraged, however, you can use it if nodes require restart or configuration updates, temporarily! | ||
func UpdateNodeConfigs(in *Input, cfg string) { | ||
in.NodeSpecs[0].Node.UserConfigOverrides = in.NodeSpecs[0].Node.UserConfigOverrides + cfg | ||
func UpgradeNodeSet(in *Input, bc *blockchain.Output, url string, wait time.Duration) (*Output, error) { | ||
_, err := chaos.ExecPumba("rm --volumes=false re2:node.*|postgresql.*", wait) | ||
if err != nil { | ||
return nil, err | ||
} | ||
in.Out = nil | ||
out, err := NewSharedDBNodeSet(in, bc, url) | ||
in.Out = out | ||
return out, err | ||
} |
This file was deleted.
Oops, something went wrong.
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,58 @@ | ||
package examples | ||
|
||
import ( | ||
"fmt" | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework" | ||
"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 CfgUpgradeAll 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 TestUpgradeAll(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(testJob) | ||
require.NoError(t, err) | ||
|
||
in.NodeSet.NodeSpecs[0].Node.Image = "public.ecr.aws/chainlink/chainlink:v2.17.0" | ||
in.NodeSet.NodeSpecs[0].Node.UserConfigOverrides = ` | ||
[Log] | ||
level = 'info' | ||
` | ||
|
||
out, err = ns.UpgradeNodeSet(in.NodeSet, bc, dp.BaseURLDocker, 10*time.Second) | ||
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) | ||
} | ||
}) | ||
} |
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,63 @@ | ||
|
||
[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.16.0" | ||
pull_image = false | ||
|
||
[[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.16.0" | ||
pull_image = false | ||
|
||
[[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.16.0" | ||
pull_image = false | ||
|
||
[[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.16.0" | ||
pull_image = false | ||
|
||
[[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.16.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
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,63 @@ | ||
|
||
[blockchain_a] | ||
chain_id = "31337" | ||
image = "f4hrenh9it/foundry:latest" | ||
port = "8545" | ||
type = "anvil" | ||
|
||
[data_provider] | ||
port = 9111 | ||
|
||
[nodeset] | ||
nodes = 5 | ||
override_mode = "each" | ||
|
||
[[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.16.0" | ||
pull_image = false | ||
|
||
[[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.16.0" | ||
pull_image = false | ||
|
||
[[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.16.0" | ||
pull_image = false | ||
|
||
[[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.16.0" | ||
pull_image = false | ||
|
||
[[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.16.0" | ||
pull_image = false |