Skip to content

Commit

Permalink
TOML feedback from Bartek
Browse files Browse the repository at this point in the history
  • Loading branch information
smickovskid committed Feb 27, 2024
1 parent d350489 commit cc1246a
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 27 deletions.
4 changes: 4 additions & 0 deletions integration-tests/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}},
}))
}

Expand Down
1 change: 0 additions & 1 deletion integration-tests/common/test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (

var (
rpcRequestTimeout = time.Second * 300
dumpPath = "/dumps/dump.pkl"
)

// OCRv2TestState Main testing state struct
Expand Down
15 changes: 13 additions & 2 deletions integration-tests/smoke/ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap/zapcore"
"maps"
"os"
"testing"
)

Expand All @@ -36,19 +37,29 @@ 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()
logging.Init()
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 {
Expand Down
9 changes: 1 addition & 8 deletions integration-tests/testconfig/configs_embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
1 change: 1 addition & 0 deletions integration-tests/testconfig/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 6 additions & 15 deletions integration-tests/testconfig/testconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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"`
}

Expand All @@ -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")
}
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion ops/devnet/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit cc1246a

Please sign in to comment.