Skip to content

Commit cb3803a

Browse files
committed
wip
1 parent 8425c4e commit cb3803a

File tree

7 files changed

+38
-35
lines changed

7 files changed

+38
-35
lines changed

framework/clclient/client.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414

1515
"github.com/ethereum/go-ethereum/common"
1616
"github.com/go-resty/resty/v2"
17-
"github.com/rs/zerolog"
1817
"github.com/rs/zerolog/log"
1918
"golang.org/x/sync/errgroup"
2019
)
@@ -57,14 +56,13 @@ func NewChainlinkClient(c *Config) (*ChainlinkClient, error) {
5756
}, nil
5857
}
5958

60-
// NewCLDefaultClients connects all the clients using clnode.Output and default login/password
61-
func NewCLDefaultClients(outs []*clnode.Output, l zerolog.Logger) ([]*ChainlinkClient, error) {
59+
func New(outs []*clnode.Output) ([]*ChainlinkClient, error) {
6260
clients := make([]*ChainlinkClient, 0)
6361
for _, out := range outs {
6462
c, err := NewChainlinkClient(&Config{
6563
URL: out.Node.HostURL,
66-
Email: clnode.DefaultAPIUser,
67-
Password: clnode.DefaultAPIPassword,
64+
Email: out.Node.APIAuthUser,
65+
Password: out.Node.APIAuthPassword,
6866
})
6967
if err != nil {
7068
return nil, err

framework/components/clnode/clnode.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ type Output struct {
6363

6464
// NodeOut is CL node container output, URLs to connect
6565
type NodeOut struct {
66-
HostURL string `toml:"url"`
67-
HostP2PURL string `toml:"p2p_url"`
68-
DockerURL string `toml:"docker_internal_url"`
69-
DockerP2PUrl string `toml:"p2p_docker_internal_url"`
66+
APIAuthUser string `toml:"api_auth_user"`
67+
APIAuthPassword string `toml:"api_auth_password"`
68+
HostURL string `toml:"url"`
69+
HostP2PURL string `toml:"p2p_url"`
70+
DockerURL string `toml:"docker_internal_url"`
71+
DockerP2PUrl string `toml:"p2p_docker_internal_url"`
7072
}
7173

7274
// NewNodeWithDB create a new Chainlink node with some image:tag and one or several configs
@@ -285,10 +287,12 @@ func newNode(in *Input, pgOut *postgres.Output) (*NodeOut, error) {
285287
mpP2P := nat.Port(fmt.Sprintf("%d/udp", in.Node.P2PPort))
286288

287289
return &NodeOut{
288-
HostURL: fmt.Sprintf("http://%s:%s", host, mp.Port()),
289-
HostP2PURL: fmt.Sprintf("http://%s:%s", host, mpP2P.Port()),
290-
DockerURL: fmt.Sprintf("http://%s:%s", containerName, DefaultHTTPPort),
291-
DockerP2PUrl: fmt.Sprintf("http://%s:%s", containerName, DefaultP2PPort),
290+
APIAuthUser: DefaultAPIUser,
291+
APIAuthPassword: DefaultAPIPassword,
292+
HostURL: fmt.Sprintf("http://%s:%s", host, mp.Port()),
293+
HostP2PURL: fmt.Sprintf("http://%s:%s", host, mpP2P.Port()),
294+
DockerURL: fmt.Sprintf("http://%s:%s", containerName, DefaultHTTPPort),
295+
DockerP2PUrl: fmt.Sprintf("http://%s:%s", containerName, DefaultP2PPort),
292296
}, nil
293297
}
294298

framework/examples/myproject/chaos_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func TestChaos(t *testing.T) {
3434
out, err := ns.NewSharedDBNodeSet(in.NodeSet, bc, dp.BaseURLDocker)
3535
require.NoError(t, err)
3636

37-
c, err := clclient.NewCLDefaultClients(out.CLNodes, framework.L)
37+
c, err := clclient.New(out.CLNodes)
3838
require.NoError(t, err)
3939

4040
t.Run("run the cluster and test various chaos scenarios", func(t *testing.T) {

framework/examples/myproject/performance_baseline_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestPerformanceBaseline(t *testing.T) {
3737
lokiCfg = wasp.NewEnvLokiConfig()
3838
}
3939

40-
c, err := clclient.NewCLDefaultClients(out.CLNodes, framework.L)
40+
c, err := clclient.New(out.CLNodes)
4141
require.NoError(t, err)
4242

4343
t.Run("performance baseline for your product", func(t *testing.T) {

framework/examples/myproject/scalability_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestScalability(t *testing.T) {
3838
lokiCfg = wasp.NewEnvLokiConfig()
3939
}
4040

41-
c, err := clclient.NewCLDefaultClients(out.CLNodes, framework.L)
41+
c, err := clclient.New(out.CLNodes)
4242
require.NoError(t, err)
4343

4444
t.Run("scalability test for your product", func(t *testing.T) {

framework/examples/myproject/upgrade.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
pull_image = true
2020

2121
[nodeset.node_specs.node]
22-
custom_ports = [14000, 14001]
2322
image = "public.ecr.aws/chainlink/chainlink:v2.16.0"
2423
pull_image = false
2524

framework/examples/myproject/upgrade_test.go

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package examples
22

33
import (
4+
"fmt"
45
"github.com/smartcontractkit/chainlink-testing-framework/framework"
56
"github.com/smartcontractkit/chainlink-testing-framework/framework/clclient"
67
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"
78
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/fake"
89
ns "github.com/smartcontractkit/chainlink-testing-framework/framework/components/simple_node_set"
910
"github.com/stretchr/testify/require"
1011
"testing"
12+
"time"
1113
)
1214

1315
const (
@@ -48,28 +50,28 @@ func TestUpgrade(t *testing.T) {
4850
out, err := ns.NewSharedDBNodeSet(in.NodeSet, bc, dp.BaseURLDocker)
4951
require.NoError(t, err)
5052

51-
c, err := clclient.NewCLDefaultClients(out.CLNodes, framework.L)
53+
c, err := clclient.New(out.CLNodes)
5254
require.NoError(t, err)
5355
_, _, err = c[0].CreateJobRaw(testJob)
5456
require.NoError(t, err)
5557

56-
// in.NodeSet.NodeSpecs[0].Node.Image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
57-
// in.NodeSet.NodeSpecs[0].Node.UserConfigOverrides = `
58-
// [Log]
59-
// level = 'info'
60-
//`
61-
// in.NodeSet.NodeSpecs[4].Node.Image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
62-
// in.NodeSet.NodeSpecs[4].Node.UserConfigOverrides = `
63-
// [Log]
64-
// level = 'info'
65-
//`
66-
//
67-
// out, err = ns.UpgradeNodeSet(in.NodeSet, bc, dp.BaseURLDocker, 3*time.Second)
68-
// require.NoError(t, err)
69-
//
70-
// jobs, _, err := c[0].ReadJobs()
71-
// require.NoError(t, err)
72-
// fmt.Println(jobs)
58+
in.NodeSet.NodeSpecs[0].Node.Image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
59+
in.NodeSet.NodeSpecs[0].Node.UserConfigOverrides = `
60+
[Log]
61+
level = 'info'
62+
`
63+
in.NodeSet.NodeSpecs[4].Node.Image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
64+
in.NodeSet.NodeSpecs[4].Node.UserConfigOverrides = `
65+
[Log]
66+
level = 'info'
67+
`
68+
69+
out, err = ns.UpgradeNodeSet(in.NodeSet, bc, dp.BaseURLDocker, 3*time.Second)
70+
require.NoError(t, err)
71+
72+
jobs, _, err := c[0].ReadJobs()
73+
require.NoError(t, err)
74+
fmt.Println(jobs)
7375

7476
t.Run("test something", func(t *testing.T) {
7577
for _, n := range out.CLNodes {

0 commit comments

Comments
 (0)