From 8d93549a1de643eca4a29731af254e4c1ad2103b Mon Sep 17 00:00:00 2001 From: skudasov Date: Wed, 6 Nov 2024 10:45:40 +0100 Subject: [PATCH] stub Loki in CI --- framework/chaos/chaos.go | 2 +- framework/examples/myproject/go.mod | 1 + framework/examples/myproject/load_test.go | 11 +++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/framework/chaos/chaos.go b/framework/chaos/chaos.go index 6fad20249..7d0928c5f 100644 --- a/framework/chaos/chaos.go +++ b/framework/chaos/chaos.go @@ -11,7 +11,7 @@ import ( "strings" ) -func NewPumbaChaos(command string) (func(), error) { +func ExecPumba(command string) (func(), error) { ctx := context.Background() cmd := strings.Split(command, " ") pumbaReq := testcontainers.ContainerRequest{ diff --git a/framework/examples/myproject/go.mod b/framework/examples/myproject/go.mod index 5a0eec6ae..f458d7773 100644 --- a/framework/examples/myproject/go.mod +++ b/framework/examples/myproject/go.mod @@ -5,6 +5,7 @@ go 1.22.7 replace ( github.com/smartcontractkit/chainlink-testing-framework/framework => ../.. github.com/smartcontractkit/chainlink-testing-framework/framework/cmd => ../../cmd/ + github.com/smartcontractkit/chainlink-testing-framework/framework/wasp => ../../wasp/ ) require ( diff --git a/framework/examples/myproject/load_test.go b/framework/examples/myproject/load_test.go index c982ce04d..b26f934f3 100644 --- a/framework/examples/myproject/load_test.go +++ b/framework/examples/myproject/load_test.go @@ -9,6 +9,7 @@ import ( ns "github.com/smartcontractkit/chainlink-testing-framework/framework/components/simple_node_set" "github.com/smartcontractkit/chainlink-testing-framework/wasp" "github.com/stretchr/testify/require" + "os" "testing" "time" ) @@ -30,6 +31,12 @@ func TestLoad(t *testing.T) { out, err := ns.NewSharedDBNodeSet(in.NodeSet, bc, dp.BaseURLDocker) require.NoError(t, err) + var lokiCfg *wasp.LokiConfig + // temp fix, we can't reach shared Loki instance in CI + if os.Getenv("CI") != "true" { + lokiCfg = wasp.NewEnvLokiConfig() + } + c, err := clclient.NewCLDefaultClients(out.CLNodes, framework.L) require.NoError(t, err) @@ -49,11 +56,11 @@ func TestLoad(t *testing.T) { "branch": "example", "commit": "example", }, - LokiConfig: wasp.NewEnvLokiConfig(), + LokiConfig: lokiCfg, })). Run(false) require.NoError(t, err) - _, err = chaos.NewPumbaChaos("netem --tc-image=gaiadocker/iproute2 --duration=1m delay --time=300 re2:node.*") + _, err = chaos.ExecPumba("netem --tc-image=gaiadocker/iproute2 --duration=1m delay --time=300 re2:node.*") require.NoError(t, err) p.Wait() })