@@ -2,12 +2,13 @@ package examples
22
33import (
44 "github.com/smartcontractkit/chainlink-testing-framework/framework"
5- "github.com/smartcontractkit/chainlink-testing-framework/framework/chaos"
65 "github.com/smartcontractkit/chainlink-testing-framework/framework/clclient"
76 "github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"
87 "github.com/smartcontractkit/chainlink-testing-framework/framework/components/fake"
98 ns "github.com/smartcontractkit/chainlink-testing-framework/framework/components/simple_node_set"
9+ "github.com/smartcontractkit/chainlink-testing-framework/wasp"
1010 "github.com/stretchr/testify/require"
11+ "os"
1112 "testing"
1213 "time"
1314)
@@ -29,44 +30,34 @@ func TestLoad(t *testing.T) {
2930 out , err := ns .NewSharedDBNodeSet (in .NodeSet , bc , dp .BaseURLDocker )
3031 require .NoError (t , err )
3132
32- // var lokiCfg *wasp.LokiConfig
33- //// temp fix, we can't reach shared Loki instance in CI
34- // if os.Getenv("CI") != "true" {
35- // lokiCfg = wasp.NewEnvLokiConfig()
36- // }
33+ var lokiCfg * wasp.LokiConfig
34+ // temp fix, we can't reach shared Loki instance in CI
35+ if os .Getenv ("CI" ) != "true" {
36+ lokiCfg = wasp .NewEnvLokiConfig ()
37+ }
3738
38- _ , err = clclient .NewCLDefaultClients (out .CLNodes , framework .L )
39+ c , err : = clclient .NewCLDefaultClients (out .CLNodes , framework .L )
3940 require .NoError (t , err )
4041
41- t .Run ("run the cluster and simulate slow network" , func (t * testing.T ) {
42- //p, err := wasp.NewProfile().
43- // Add(wasp.NewGenerator(&wasp.Config{
44- // T: t,
45- // LoadType: wasp.RPS,
46- // Schedule: wasp.Combine(
47- // wasp.Steps(1, 1, 9, 30*time.Second),
48- // wasp.Plain(10, 30*time.Second),
49- // wasp.Steps(10, -1, 10, 30*time.Second),
50- // ),
51- // Gun: NewCLNodeGun(c[0], "bridges"),
52- // Labels: map[string]string{
53- // "gen_name": "cl_node_api_call",
54- // "branch": "example",
55- // "commit": "example",
56- // },
57- // LokiConfig: lokiCfg,
58- // })).
59- // Run(false)
60- //require.NoError(t, err)
61- // example commands for Pumba:
62- // stop --duration=1s --restart re2:node0 # stop one container for 1s and restart
63- // "netem --tc-image=gaiadocker/iproute2 --duration=1m delay --time=300 re2:node.* # slow network
64- _ , err = chaos .ExecPumba ("stop --duration=1s --restart re2:node0" )
42+ t .Run ("load test chainlink nodes" , func (t * testing.T ) {
43+ _ , err := wasp .NewProfile ().
44+ Add (wasp .NewGenerator (& wasp.Config {
45+ T : t ,
46+ LoadType : wasp .RPS ,
47+ Schedule : wasp .Combine (
48+ wasp .Steps (1 , 1 , 9 , 30 * time .Second ),
49+ wasp .Plain (10 , 30 * time .Second ),
50+ wasp .Steps (10 , - 1 , 10 , 30 * time .Second ),
51+ ),
52+ Gun : NewCLNodeGun (c [0 ], "bridges" ),
53+ Labels : map [string ]string {
54+ "gen_name" : "cl_node_api_call" ,
55+ "branch" : "example" ,
56+ "commit" : "example" ,
57+ },
58+ LokiConfig : lokiCfg ,
59+ })).
60+ Run (true )
6561 require .NoError (t , err )
66- time .Sleep (5 * time .Second )
67- _ , err = clclient .NewCLDefaultClients (out .CLNodes , framework .L )
68- require .NoError (t , err )
69-
70- //p.Wait()
7162 })
7263}
0 commit comments