Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VojtechVitek committed Oct 4, 2024
1 parent 2e9c4fb commit a871cd7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
5 changes: 1 addition & 4 deletions hydrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/0xsequence/go-cloudsecrets/gcp"
"github.com/0xsequence/go-cloudsecrets/nosecrets"
"github.com/davecgh/go-spew/spew"
"golang.org/x/sync/errgroup"
)

Expand Down Expand Up @@ -55,12 +54,10 @@ func hydrateConfig(ctx context.Context, provider secretsProvider, v reflect.Valu
}

ga := &collector{}
ga.collectSecretFields(v, "")
ga.collectSecretFields(v, "config")

fields := ga.fields

spew.Dump(fields)

g := &errgroup.Group{}
for _, field := range fields {
field := field
Expand Down
10 changes: 2 additions & 8 deletions hydrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@ type analytics struct {
func TestFailWhenPassedValueIsNotStruct(t *testing.T) {
input := "hello"

v := reflect.ValueOf(input)
provider := mock.NewSecretsProvider(map[string]string{
"dbPassword": "changethissecret",
"analyticsPassword": "AuthTokenSecret",
})

assert.Error(t, hydrateStruct(context.Background(), provider, v))
assert.Error(t, Hydrate(context.Background(), "", input))
}

func TestReplacePlaceholdersWithSecrets(t *testing.T) {
Expand Down Expand Up @@ -117,7 +111,7 @@ func TestReplacePlaceholdersWithSecrets(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := reflect.ValueOf(tt.conf)
err := hydrateStruct(ctx, mock.NewSecretsProvider(tt.storage), v)
err := hydrateConfig(ctx, mock.NewSecretsProvider(tt.storage), v)
if err != nil {
if tt.wantErr {
assert.Equal(t, tt.wantConf, tt.conf)
Expand Down

0 comments on commit a871cd7

Please sign in to comment.