Skip to content

Commit

Permalink
bake: test secrets override
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max committed Jan 14, 2025
1 parent 1eb167a commit 3090004
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bake/bake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ target "webapp" {
args = {
VAR_BOTH = "webapp"
}
secret = [
"id=FOO,env=FOO"
]
inherits = ["webDEP"]
}`),
}
Expand Down Expand Up @@ -150,6 +153,15 @@ target "webapp" {
require.Equal(t, []string{"webapp"}, g["default"].Targets)
})

t.Run("SecretsOverride", func(t *testing.T) {
t.Setenv("FOO", "foo")
t.Setenv("BAR", "bar")
m, _, err := ReadTargets(ctx, []File{fp}, []string{"webapp"}, []string{"webapp.secrets=id=BAR,env=BAR"}, nil, &EntitlementConf{})
require.NoError(t, err)
require.Len(t, m["webapp"].Secrets, 1)
require.Equal(t, "BAR", m["webapp"].Secrets[0].ID)
})

t.Run("PatternOverride", func(t *testing.T) {
t.Parallel()
// same check for two cases
Expand Down

0 comments on commit 3090004

Please sign in to comment.