Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcl committed Aug 9, 2024
1 parent ac89526 commit 8a82cb2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ require (
github.com/google/uuid v1.6.0
github.com/lib/pq v1.10.9
github.com/pelletier/go-toml/v2 v2.2.2
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.31.0
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240805160614-501c4f40b98c
github.com/smartcontractkit/chainlink-solana v1.1.0
Expand Down Expand Up @@ -330,6 +329,7 @@ require (
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/alertmanager v0.26.0 // indirect
Expand Down
33 changes: 17 additions & 16 deletions integration-tests/testconfig/testconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"time"

"github.com/pkg/errors"
"errors"

"github.com/barkimedes/go-deepcopy"
"github.com/google/uuid"
Expand Down Expand Up @@ -48,10 +48,11 @@ type TestConfig struct {
}

const (
E2E_TEST_COMMON_RPC_URL_ENV = "E2E_TEST_COMMON_RPC_URL"
E2E_TEST_COMMON_WS_URL_ENV = "E2E_TEST_COMMON_WS_URL"
E2E_TEST_COMMON_PRIVATE_KEY_ENV = "E2E_TEST_COMMON_PRIVATE_KEY" // Private key in byte format [12, 12 ...]
E2E_TEST_SOLANA_SECRET = "E2E_TEST_SOLANA_SECRET"
E2E_TEST_COMMON_RPC_URL_ENV = "E2E_TEST_COMMON_RPC_URL" // revive:disable-line:var-naming
E2E_TEST_COMMON_WS_URL_ENV = "E2E_TEST_COMMON_WS_URL" // revive:disable-line:var-naming
// Private key in byte format [12, 12 ...]
E2E_TEST_COMMON_PRIVATE_KEY_ENV = "E2E_TEST_COMMON_PRIVATE_KEY" // revive:disable-line:var-naming
E2E_TEST_SOLANA_SECRET = "E2E_TEST_SOLANA_SECRET" // revive:disable-line:var-naming
)

// Read config values from environment variables
Expand Down Expand Up @@ -106,28 +107,28 @@ func (c *TestConfig) ReadFromEnvVar() error {
c.Logging.Loki.BearerToken = &lokiBearerToken
}

grafanaBaseUrl := ctf_config.MustReadEnvVar_String(ctf_config.E2E_TEST_GRAFANA_BASE_URL_ENV)
if grafanaBaseUrl != "" {
grafanaBaseURL := ctf_config.MustReadEnvVar_String(ctf_config.E2E_TEST_GRAFANA_BASE_URL_ENV)
if grafanaBaseURL != "" {
if c.Logging == nil {
c.Logging = &ctf_config.LoggingConfig{}
}
if c.Logging.Grafana == nil {
c.Logging.Grafana = &ctf_config.GrafanaConfig{}
}
logger.Info().Msgf("Using %s env var to override Logging.Grafana.BaseUrl", ctf_config.E2E_TEST_GRAFANA_BASE_URL_ENV)
c.Logging.Grafana.BaseUrl = &grafanaBaseUrl
c.Logging.Grafana.BaseUrl = &grafanaBaseURL
}

grafanaDashboardUrl := ctf_config.MustReadEnvVar_String(ctf_config.E2E_TEST_GRAFANA_DASHBOARD_URL_ENV)
if grafanaDashboardUrl != "" {
grafanaDashboardURL := ctf_config.MustReadEnvVar_String(ctf_config.E2E_TEST_GRAFANA_DASHBOARD_URL_ENV)
if grafanaDashboardURL != "" {
if c.Logging == nil {
c.Logging = &ctf_config.LoggingConfig{}
}
if c.Logging.Grafana == nil {
c.Logging.Grafana = &ctf_config.GrafanaConfig{}
}
logger.Info().Msgf("Using %s env var to override Logging.Grafana.DashboardUrl", ctf_config.E2E_TEST_GRAFANA_DASHBOARD_URL_ENV)
c.Logging.Grafana.DashboardUrl = &grafanaDashboardUrl
c.Logging.Grafana.DashboardUrl = &grafanaDashboardURL
}

grafanaBearerToken := ctf_config.MustReadEnvVar_String(ctf_config.E2E_TEST_GRAFANA_BEARER_TOKEN_ENV)
Expand Down Expand Up @@ -169,13 +170,13 @@ func (c *TestConfig) ReadFromEnvVar() error {
c.Network.WalletKeys = walletKeys
}

rpcHttpUrls := ctf_config.ReadEnvVarGroupedMap(ctf_config.E2E_TEST_RPC_HTTP_URL_ENV, ctf_config.E2E_TEST_RPC_HTTP_URLS_ENV)
if len(rpcHttpUrls) > 0 {
rpcHTTPUrls := ctf_config.ReadEnvVarGroupedMap(ctf_config.E2E_TEST_RPC_HTTP_URL_ENV, ctf_config.E2E_TEST_RPC_HTTP_URLS_ENV)
if len(rpcHTTPUrls) > 0 {
if c.Network == nil {
c.Network = &ctf_config.NetworkConfig{}
}
logger.Info().Msgf("Using %s and/or %s env vars to override Network.RpcHttpUrls", ctf_config.E2E_TEST_RPC_HTTP_URL_ENV, ctf_config.E2E_TEST_RPC_HTTP_URLS_ENV)
c.Network.RpcHttpUrls = rpcHttpUrls
c.Network.RpcHttpUrls = rpcHTTPUrls
}

rpcWsUrls := ctf_config.ReadEnvVarGroupedMap(ctf_config.E2E_TEST_RPC_WS_URL_ENV, ctf_config.E2E_TEST_RPC_WS_URLS_ENV)
Expand Down Expand Up @@ -561,13 +562,13 @@ func GetConfig(configurationName string, product Product) (TestConfig, error) {
logger.Info().Msg("Loading config values from default ~/.testsecrets env file")
err = ctf_config.LoadSecretEnvsFromFiles()
if err != nil {
return TestConfig{}, errors.Wrapf(err, "error reading test config values from ~/.testsecrets file")
return TestConfig{}, fmt.Errorf("error reading test config values from ~/.testsecrets file: %w", err)
}

logger.Info().Msg("Reading values from environment variables")
err = testConfig.ReadFromEnvVar()
if err != nil {
return TestConfig{}, errors.Wrapf(err, "error reading test config values from env vars")
return TestConfig{}, fmt.Errorf("error reading test config values from env vars: %w", err)
}

logger.Debug().Msg("Validating test config")
Expand Down

0 comments on commit 8a82cb2

Please sign in to comment.