fix: Allow unsetting the last remaining values file (#3644) (#3645)

* fix: Allow unsetting the last values file (#3644)

Because the `setHelmOpt()` function does not act on empty inputs, it 
would do nothing when removing the last values file using `argocd app 
unset`.
The parameter overrides are actually being unset correctly, so this has 
been changed to work the same way by manipulating `app.Spec.Source.Helm` 
directly.

This fixes #3644.

* fix: Allow unsetting the last values file, add tests

* Retrigger CI pipeline
This commit is contained in:
Henno Schooljan 2020-05-30 07:27:40 +02:00 committed by GitHub
parent d89b7d8a41
commit 7b2a95e83c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -123,6 +123,34 @@ func TestHelmValues(t *testing.T) {
})
}
func TestHelmValuesMultipleUnset(t *testing.T) {
Given(t).
Path("helm").
When().
AddFile("foo.yml", "").
AddFile("baz.yml", "").
Create().
AppSet("--values", "foo.yml", "--values", "baz.yml").
Then().
And(func(app *Application) {
assert.NotNil(t, app.Spec.Source.Helm)
assert.Equal(t, []string{"foo.yml", "baz.yml"}, app.Spec.Source.Helm.ValueFiles)
}).
When().
AppUnSet("--values", "foo.yml").
Then().
And(func(app *Application) {
assert.NotNil(t, app.Spec.Source.Helm)
assert.Equal(t, []string{"baz.yml"}, app.Spec.Source.Helm.ValueFiles)
}).
When().
AppUnSet("--values", "baz.yml").
Then().
And(func(app *Application) {
assert.Nil(t, app.Spec.Source.Helm)
})
}
func TestHelmValuesLiteralFileLocal(t *testing.T) {
Given(t).
Path("helm").