From cc1246a6acdedbe95e8c2b36c929bac1dcb9c358 Mon Sep 17 00:00:00 2001 From: Damjan Smickovski Date: Tue, 27 Feb 2024 14:48:03 +0100 Subject: [PATCH] TOML feedback from Bartek --- integration-tests/common/common.go | 4 ++++ integration-tests/common/test_common.go | 1 - integration-tests/smoke/ocr2_test.go | 15 +++++++++++-- integration-tests/testconfig/configs_embed.go | 9 +------- integration-tests/testconfig/default.toml | 1 + integration-tests/testconfig/testconfig.go | 21 ++++++------------- ops/devnet/environment.go | 2 +- 7 files changed, 26 insertions(+), 27 deletions(-) diff --git a/integration-tests/common/common.go b/integration-tests/common/common.go index aa5153795..3c0d04f5f 100644 --- a/integration-tests/common/common.go +++ b/integration-tests/common/common.go @@ -118,6 +118,10 @@ func (c *Common) Default(t *testing.T, namespacePrefix string) (*Common, error) AddHelm(chainlink.New(0, map[string]interface{}{ "toml": tomlString, "replicas": *c.TestConfig.OCR2.NodeCount, + "db": map[string]any{ + "image": map[string]any{ + "version": "15.5", + }}, })) } diff --git a/integration-tests/common/test_common.go b/integration-tests/common/test_common.go index a87d04a23..6cd3a776e 100644 --- a/integration-tests/common/test_common.go +++ b/integration-tests/common/test_common.go @@ -34,7 +34,6 @@ import ( var ( rpcRequestTimeout = time.Second * 300 - dumpPath = "/dumps/dump.pkl" ) // OCRv2TestState Main testing state struct diff --git a/integration-tests/smoke/ocr2_test.go b/integration-tests/smoke/ocr2_test.go index e90345ed6..f28cb6f8d 100644 --- a/integration-tests/smoke/ocr2_test.go +++ b/integration-tests/smoke/ocr2_test.go @@ -13,6 +13,7 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap/zapcore" "maps" + "os" "testing" ) @@ -36,11 +37,21 @@ func TestOCRBasicNew(t *testing.T) { // "CL_SOLANA_CMD": "chainlink-solana", //}}, } { - config, err := tc.GetConfig("Smoke", tc.OCR2) if err != nil { t.Fatal(err) } + + // We have to export these since the charts read from env + if *config.Common.InsideK8s { + err = os.Setenv("CHAINLINK_IMAGE", *config.ChainlinkImage.Image) + require.NoError(t, err, "Could not pull image from config") + err = os.Setenv("CHAINLINK_VERSION", *config.ChainlinkImage.Version) + require.NoError(t, err, "Could not pull version from config") + err = os.Setenv("CHAINLINK_ENV_USER", *config.Common.User) + require.NoError(t, err, "Could not pull user from config") + } + test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -48,7 +59,7 @@ func TestOCRBasicNew(t *testing.T) { state, err := common.NewOCRv2State(t, "smoke-ocr2", &config) require.NoError(t, err, "Could not setup the ocrv2 state") - // Cleanup K8s + // K8s specific config and cleanup if *config.Common.InsideK8s { t.Cleanup(func() { if err := actions.TeardownSuite(t, state.Common.Env, state.ChainlinkNodesK8s, nil, zapcore.PanicLevel, nil); err != nil { diff --git a/integration-tests/testconfig/configs_embed.go b/integration-tests/testconfig/configs_embed.go index 67e954ff5..e9decaa4c 100644 --- a/integration-tests/testconfig/configs_embed.go +++ b/integration-tests/testconfig/configs_embed.go @@ -6,14 +6,7 @@ package testconfig import "embed" //go:embed default.toml -//go:embed automation/automation.toml -//go:embed functions/functions.toml -//go:embed keeper/keeper.toml -//go:embed log_poller/log_poller.toml -//go:embed node/node.toml -//go:embed ocr/ocr.toml -//go:embed vrfv2/vrfv2.toml -//go:embed vrfv2plus/vrfv2plus.toml +//go:embed ocr2/ocr2.toml var embeddedConfigsFs embed.FS func init() { diff --git a/integration-tests/testconfig/default.toml b/integration-tests/testconfig/default.toml index 7a4da2f36..884f8d86b 100644 --- a/integration-tests/testconfig/default.toml +++ b/integration-tests/testconfig/default.toml @@ -20,6 +20,7 @@ simulated = ["wss://127.0.0.1"] # Not needed for Starknet but mandatory from CTF [Common] inside_k8 = false network = "localnet" +user = "satoshi" [OCR2] node_count = 6 diff --git a/integration-tests/testconfig/testconfig.go b/integration-tests/testconfig/testconfig.go index 603fa6ebf..6faab8bb7 100644 --- a/integration-tests/testconfig/testconfig.go +++ b/integration-tests/testconfig/testconfig.go @@ -41,10 +41,6 @@ type Ocr2TestConfig interface { GetOCR2Config() *ocr2_config.Config } -type NamedConfiguration interface { - GetConfigurationName() string -} - type TestConfig struct { ChainlinkImage *ctf_config.ChainlinkImageConfig `toml:"ChainlinkImage"` Logging *ctf_config.LoggingConfig `toml:"Logging"` @@ -135,6 +131,7 @@ func (c *TestConfig) AsBase64() (string, error) { type Common struct { Network *string `toml:"network"` InsideK8s *bool `toml:"inside_k8"` + User *string `toml:"user"` L2RPCUrl *string `toml:"l2_rpc_url"` } @@ -155,6 +152,11 @@ func (c *Common) Validate() error { if c.InsideK8s == nil { return fmt.Errorf("inside_k8 must be set") } + + if c.User == nil { + return fmt.Errorf("user must be set") + } + if c.L2RPCUrl == nil && *c.Network == "testnet" { return fmt.Errorf("l2_rpc_url must be set") } @@ -168,19 +170,8 @@ const ( OCR2 Product = "ocr2" ) -var TestTypesWithLoki = []string{"Soak", "Smoke"} - const TestTypeEnvVarName = "TEST_TYPE" -func GetConfigurationNameFromEnv() (string, error) { - testType := os.Getenv(TestTypeEnvVarName) - if testType == "" { - return "", fmt.Errorf("%s env var not set", TestTypeEnvVarName) - } - - return cases.Title(language.English, cases.NoLower).String(testType), nil -} - const ( Base64OverrideEnvVarName = k8s_config.EnvBase64ConfigOverride NoKey = "NO_KEY" diff --git a/ops/devnet/environment.go b/ops/devnet/environment.go index c1ef5aa6c..990636a6c 100644 --- a/ops/devnet/environment.go +++ b/ops/devnet/environment.go @@ -73,7 +73,7 @@ func defaultProps() map[string]any { "starknet-dev": map[string]any{ "image": map[string]any{ "image": "shardlabs/starknet-devnet-rs", - "version": "latest", + "version": "b41e566a3f17aa0e51871f02d5165959e50ce358", }, "resources": map[string]any{ "requests": map[string]any{