11package examples
22
33import (
4- "fmt"
54 "github.com/smartcontractkit/chainlink-testing-framework/framework"
5+ "github.com/smartcontractkit/chainlink-testing-framework/framework/chaos"
6+ "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"
@@ -13,56 +14,47 @@ import (
1314)
1415
1516type CfgLoad struct {
16- BlockchainA * blockchain.Input `toml:"blockchain_a" validate:"required"`
17- //Contracts *onchain.Input `toml:"contracts" validate:"required"`
18- MockerDataProvider * fake.Input `toml:"data_provider" validate:"required"`
19- NodeSet * ns.Input `toml:"nodeset" validate:"required"`
17+ BlockchainA * blockchain.Input `toml:"blockchain_a" validate:"required"`
18+ MockerDataProvider * fake.Input `toml:"data_provider" validate:"required"`
19+ NodeSet * ns.Input `toml:"nodeset" validate:"required"`
2020}
2121
2222func TestLoad (t * testing.T ) {
2323 in , err := framework.Load [CfgLoad ](t )
2424 require .NoError (t , err )
25- //pkey := os.Getenv("PRIVATE_KEY")
2625
2726 bc , err := blockchain .NewBlockchainNetwork (in .BlockchainA )
2827 require .NoError (t , err )
2928 dp , err := fake .NewFakeDataProvider (in .MockerDataProvider )
3029 require .NoError (t , err )
31- _ , err = ns .NewSharedDBNodeSet (in .NodeSet , bc , dp .BaseURLDocker )
30+ out , err : = ns .NewSharedDBNodeSet (in .NodeSet , bc , dp .BaseURLDocker )
3231 require .NoError (t , err )
3332
34- //// deploy product contracts
35- //in.Contracts.URL = bc.Nodes[0].HostWSUrl
36- //contracts, err := onchain.NewProductOnChainDeployment(in.Contracts)
37- //require.NoError(t, err)
38- //
39- //sc, err := seth.NewClientBuilder().
40- // WithRpcUrl(bc.Nodes[0].HostWSUrl).
41- // WithGasPriceEstimations(true, 0, seth.Priority_Fast).
42- // WithTracing(seth.TracingLevel_All, []string{seth.TraceOutput_Console}).
43- // WithPrivateKeys([]string{pkey}).
44- // Build()
45- //require.NoError(t, err)
33+ c , err := clclient .NewCLDefaultClients (out .CLNodes , framework .L )
34+ require .NoError (t , err )
4635
47- t .Run ("test something" , func (t * testing.T ) {
48- labels := map [string ]string {
49- "go_test_name" : "generator_healthcheck" ,
50- "gen_name" : "generator_healthcheck" ,
51- "branch" : "generator_healthcheck" ,
52- "commit" : "generator_healthcheck" ,
53- }
54- gen , err := wasp .NewGenerator (& wasp.Config {
55- LoadType : wasp .RPS ,
56- Schedule : wasp .Combine (
57- wasp .Steps (1 , 1 , 9 , 30 * time .Second ),
58- wasp .Plain (10 , 30 * time .Second ),
59- wasp .Steps (10 , - 1 , 10 , 30 * time .Second ),
60- ),
61- Gun : NewExampleHTTPGun (fmt .Sprintf ("%s/mock1" , dp .BaseURLHost )),
62- Labels : labels ,
63- LokiConfig : wasp .NewEnvLokiConfig (),
64- })
36+ t .Run ("run the cluster and simulate slow network" , func (t * testing.T ) {
37+ p , err := wasp .NewProfile ().
38+ Add (wasp .NewGenerator (& wasp.Config {
39+ T : t ,
40+ LoadType : wasp .RPS ,
41+ Schedule : wasp .Combine (
42+ wasp .Steps (1 , 1 , 9 , 30 * time .Second ),
43+ wasp .Plain (10 , 30 * time .Second ),
44+ wasp .Steps (10 , - 1 , 10 , 30 * time .Second ),
45+ ),
46+ Gun : NewCLNodeGun (c [0 ], "bridges" ),
47+ Labels : map [string ]string {
48+ "gen_name" : "cl_node_api_call" ,
49+ "branch" : "example" ,
50+ "commit" : "example" ,
51+ },
52+ LokiConfig : wasp .NewEnvLokiConfig (),
53+ })).
54+ Run (false )
55+ require .NoError (t , err )
56+ _ , err = chaos .NewPumbaChaos ("netem --tc-image=gaiadocker/iproute2 --duration=1m delay --time=300 re2:node.*" )
6557 require .NoError (t , err )
66- gen . Run ( true )
58+ p . Wait ( )
6759 })
6860}
0 commit comments