|
| 1 | +package examples |
| 2 | + |
| 3 | +import ( |
| 4 | + "fmt" |
| 5 | + "github.com/smartcontractkit/chainlink-testing-framework/framework" |
| 6 | + "github.com/smartcontractkit/chainlink-testing-framework/framework/clclient" |
| 7 | + "github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain" |
| 8 | + "github.com/smartcontractkit/chainlink-testing-framework/framework/components/fake" |
| 9 | + ns "github.com/smartcontractkit/chainlink-testing-framework/framework/components/simple_node_set" |
| 10 | + "github.com/stretchr/testify/require" |
| 11 | + "testing" |
| 12 | + "time" |
| 13 | +) |
| 14 | + |
| 15 | +type CfgUpgradeAll struct { |
| 16 | + BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"` |
| 17 | + MockerDataProvider *fake.Input `toml:"data_provider" validate:"required"` |
| 18 | + NodeSet *ns.Input `toml:"nodeset" validate:"required"` |
| 19 | +} |
| 20 | + |
| 21 | +func TestUpgradeAll(t *testing.T) { |
| 22 | + in, err := framework.Load[CfgUpgradeAll](t) |
| 23 | + require.NoError(t, err) |
| 24 | + |
| 25 | + bc, err := blockchain.NewBlockchainNetwork(in.BlockchainA) |
| 26 | + require.NoError(t, err) |
| 27 | + dp, err := fake.NewFakeDataProvider(in.MockerDataProvider) |
| 28 | + require.NoError(t, err) |
| 29 | + |
| 30 | + // deploy first time |
| 31 | + out, err := ns.NewSharedDBNodeSet(in.NodeSet, bc, dp.BaseURLDocker) |
| 32 | + require.NoError(t, err) |
| 33 | + |
| 34 | + c, err := clclient.NewCLDefaultClients(out.CLNodes, framework.L) |
| 35 | + require.NoError(t, err) |
| 36 | + _, _, err = c[0].CreateJobRaw(testJob) |
| 37 | + require.NoError(t, err) |
| 38 | + |
| 39 | + in.NodeSet.NodeSpecs[0].Node.Image = "public.ecr.aws/chainlink/chainlink:v2.17.0" |
| 40 | + in.NodeSet.NodeSpecs[0].Node.UserConfigOverrides = ` |
| 41 | + [Log] |
| 42 | + level = 'info' |
| 43 | +` |
| 44 | + |
| 45 | + out, err = ns.UpgradeNodeSet(in.NodeSet, bc, dp.BaseURLDocker, 5*time.Second) |
| 46 | + require.NoError(t, err) |
| 47 | + |
| 48 | + jobs, _, err := c[0].ReadJobs() |
| 49 | + require.NoError(t, err) |
| 50 | + fmt.Println(jobs) |
| 51 | + |
| 52 | + t.Run("test something", func(t *testing.T) { |
| 53 | + for _, n := range out.CLNodes { |
| 54 | + require.NotEmpty(t, n.Node.HostURL) |
| 55 | + require.NotEmpty(t, n.Node.HostP2PURL) |
| 56 | + } |
| 57 | + }) |
| 58 | +} |
0 commit comments