mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-02 14:48:37 +02:00
fix issue 1093 (#1094)
This commit is contained in:
@@ -37,7 +37,9 @@ func forbidEnvironmentsWithReleases(filePath string, content []byte) (bool, erro
|
||||
if k == "environments" || k == "releases" || k == "---" {
|
||||
if _, ok := resultKeys[k]; !ok {
|
||||
result = append(result, k)
|
||||
resultKeys[k] = nil
|
||||
if k != "---" {
|
||||
resultKeys[k] = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,14 @@ func TestForbidEnvironmentsWithReleases(t *testing.T) {
|
||||
expectedErr: false,
|
||||
isStrict: false,
|
||||
},
|
||||
{
|
||||
name: "no error when has --- between releases and environments, and --- on top of helmfile.yaml.gotmpl",
|
||||
filePath: "helmfile.yaml.gotmpl",
|
||||
content: []byte("---\nenvironments:\n---\nreleases:\n"),
|
||||
v1mode: false,
|
||||
expectedErr: false,
|
||||
isStrict: false,
|
||||
},
|
||||
{
|
||||
name: "error when both releases and environments",
|
||||
filePath: "helmfile.yaml.gotmpl",
|
||||
@@ -50,8 +58,8 @@ func TestForbidEnvironmentsWithReleases(t *testing.T) {
|
||||
isStrict: false,
|
||||
},
|
||||
{
|
||||
name: "no error when both releases and environments for plain yaml on v1",
|
||||
filePath: "helmfile.yaml.gotmpl",
|
||||
name: "error when both releases and environments for plain yaml on v1",
|
||||
filePath: "helmfile.yaml",
|
||||
content: []byte("environments:\nreleases:\n"),
|
||||
v1mode: true,
|
||||
expectedErr: true,
|
||||
|
||||
Reference in New Issue
Block a user