Skip to content

Commit

Permalink
feature/2268-multiple-secrets-files: refactoring test fixtures back t…
Browse files Browse the repository at this point in the history
…o chainlink package
  • Loading branch information
patrickhuie19 committed Jul 17, 2023
1 parent 4ee98cc commit b61652a
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 54 deletions.
16 changes: 8 additions & 8 deletions core/cmd/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ func Test_initServerConfig(t *testing.T) {
opts: new(chainlink.GeneralConfigOpts),
fileNames: []string{testtomlutils.WriteTOMLFile(t, testConfigFileContents, "test.toml")},
secretsFiles: []string{
"../testdata/mergingsecretsdata/secrets-database.toml",
"../testdata/mergingsecretsdata/secrets-explorer.toml",
"../testdata/mergingsecretsdata/secrets-password.toml",
"../testdata/mergingsecretsdata/secrets-pyroscope.toml",
"../testdata/mergingsecretsdata/secrets-prometheus.toml",
"../testdata/mergingsecretsdata/secrets-mercury-split-one.toml",
"../testdata/mergingsecretsdata/secrets-mercury-split-two.toml",
"../testdata/mergingsecretsdata/secrets-threshold.toml",
"../services/chainlink/testdata/mergingsecretsdata/secrets-database.toml",
"../services/chainlink/testdata/mergingsecretsdata/secrets-explorer.toml",
"../services/chainlink/testdata/mergingsecretsdata/secrets-password.toml",
"../services/chainlink/testdata/mergingsecretsdata/secrets-pyroscope.toml",
"../services/chainlink/testdata/mergingsecretsdata/secrets-prometheus.toml",
"../services/chainlink/testdata/mergingsecretsdata/secrets-mercury-split-one.toml",
"../services/chainlink/testdata/mergingsecretsdata/secrets-mercury-split-two.toml",
"../services/chainlink/testdata/mergingsecretsdata/secrets-threshold.toml",
},
},
wantErr: false,
Expand Down
29 changes: 0 additions & 29 deletions core/common_secrets_merging.go

This file was deleted.

2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ require (
go.uber.org/zap v1.24.0 // indirect
golang.org/x/arch v0.4.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/sync v0.3.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1686,8 +1686,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME=
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us=
golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
Expand Down
41 changes: 32 additions & 9 deletions core/services/chainlink/config_general_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

core "github.com/smartcontractkit/chainlink/v2/core"
"github.com/smartcontractkit/chainlink/v2/core/config/env"
"github.com/smartcontractkit/chainlink/v2/core/config/toml"
"github.com/smartcontractkit/chainlink/v2/core/utils/config"
Expand Down Expand Up @@ -131,23 +130,47 @@ func TestConfig_LogSQL(t *testing.T) {
assert.Equal(t, config.Database().LogSQL(), false)
}

//go:embed testdata/mergingsecretsdata/secrets-database.toml
var databaseSecretsTOML string

//go:embed testdata/mergingsecretsdata/secrets-explorer.toml
var explorerSecretsTOML string

//go:embed testdata/mergingsecretsdata/secrets-password.toml
var passwordSecretsTOML string

//go:embed testdata/mergingsecretsdata/secrets-pyroscope.toml
var pyroscopeSecretsTOML string

//go:embed testdata/mergingsecretsdata/secrets-prometheus.toml
var prometheusSecretsTOML string

//go:embed testdata/mergingsecretsdata/secrets-mercury-split-one.toml
var mercurySecretsTOMLSplitOne string

//go:embed testdata/mergingsecretsdata/secrets-mercury-split-two.toml
var mercurySecretsTOMLSplitTwo string

//go:embed testdata/mergingsecretsdata/secrets-threshold.toml
var thresholdSecretsTOML string

func TestConfig_SecretsMerging(t *testing.T) {
t.Run("verify secrets merging in GeneralConfigOpts.New()", func(t *testing.T) {
databaseSecrets, err := parseSecrets(core.DatabaseSecretsTOML)
databaseSecrets, err := parseSecrets(databaseSecretsTOML)
require.NoErrorf(t, err, "error: %s", err)
explorerSecrets, err1 := parseSecrets(core.ExplorerSecretsTOML)
explorerSecrets, err1 := parseSecrets(explorerSecretsTOML)
require.NoErrorf(t, err1, "error: %s", err1)
passwordSecrets, err2 := parseSecrets(core.PasswordSecretsTOML)
passwordSecrets, err2 := parseSecrets(passwordSecretsTOML)
require.NoErrorf(t, err2, "error: %s", err2)
pyroscopeSecrets, err3 := parseSecrets(core.PyroscopeSecretsTOML)
pyroscopeSecrets, err3 := parseSecrets(pyroscopeSecretsTOML)
require.NoErrorf(t, err3, "error: %s", err3)
prometheusSecrets, err4 := parseSecrets(core.PrometheusSecretsTOML)
prometheusSecrets, err4 := parseSecrets(prometheusSecretsTOML)
require.NoErrorf(t, err4, "error: %s", err4)
mercurySecrets_a, err5 := parseSecrets(core.MercurySecretsTOMLSplitOne)
mercurySecrets_a, err5 := parseSecrets(mercurySecretsTOMLSplitOne)
require.NoErrorf(t, err5, "error: %s", err5)
mercurySecrets_b, err6 := parseSecrets(core.MercurySecretsTOMLSplitTwo)
mercurySecrets_b, err6 := parseSecrets(mercurySecretsTOMLSplitTwo)
require.NoErrorf(t, err6, "error: %s", err6)
thresholdSecrets, err7 := parseSecrets(core.ThresholdSecretsTOML)
thresholdSecrets, err7 := parseSecrets(thresholdSecretsTOML)
require.NoErrorf(t, err7, "error: %s", err7)

opts := new(GeneralConfigOpts)
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1692,8 +1692,6 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME=
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us=
golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.4.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.12.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1657,8 +1657,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME=
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us=
golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
Expand Down

0 comments on commit b61652a

Please sign in to comment.