cleanup: remove all about v0.x (#1903)

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* refactor(two_pass_renderer): remove unused imports and functions

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

---------

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero
2025-02-05 13:50:16 -05:00
committed by GitHub
parent 8afffa5c98
commit d7bcd5e998
229 changed files with 510 additions and 9464 deletions
+2 -4
View File
@@ -9,8 +9,6 @@ import (
"slices"
"strings"
"unicode"
"github.com/helmfile/helmfile/pkg/runtime"
)
var (
@@ -51,7 +49,7 @@ func forbidEnvironmentsWithReleases(filePath string, content []byte) (bool, erro
}
for i := 0; i < len(result)-1; i++ {
if result[i] != "---" && result[i+1] != "---" {
return runtime.V1Mode, EnvironmentsAndReleasesWithinSameYamlPartErr
return true, EnvironmentsAndReleasesWithinSameYamlPartErr
}
}
return false, nil
@@ -123,7 +121,7 @@ func TopConfigKeysVerifier(filePath string, helmfileContent []byte) (bool, error
preKey := orderKeys[i-1]
currentKey := orderKeys[i]
if topkeysPriority[preKey] > topkeysPriority[currentKey] {
return runtime.V1Mode, fmt.Errorf("top-level config key %s must be defined before %s in %s", currentKey, preKey, filePath)
return true, fmt.Errorf("top-level config key %s must be defined before %s in %s", currentKey, preKey, filePath)
}
}
return false, nil
+5 -22
View File
@@ -4,15 +4,12 @@ import (
"testing"
"github.com/stretchr/testify/require"
"github.com/helmfile/helmfile/pkg/runtime"
)
func TestForbidEnvironmentsWithReleases(t *testing.T) {
testCases := []struct {
name string
filePath string
v1mode bool
content []byte
expectedErr bool
isStrict bool
@@ -21,7 +18,6 @@ func TestForbidEnvironmentsWithReleases(t *testing.T) {
name: "no error when only releases",
filePath: "helmfile.yaml",
content: []byte("releases:\n"),
v1mode: false,
expectedErr: false,
isStrict: false,
},
@@ -29,7 +25,6 @@ func TestForbidEnvironmentsWithReleases(t *testing.T) {
name: "no error when only environments",
filePath: "helmfile.yaml",
content: []byte("environments:\n"),
v1mode: false,
expectedErr: false,
isStrict: false,
},
@@ -37,7 +32,6 @@ func TestForbidEnvironmentsWithReleases(t *testing.T) {
name: "no error when has --- between releases and environments",
filePath: "helmfile.yaml",
content: []byte("environments:\n---\nreleases:\n"),
v1mode: false,
expectedErr: false,
isStrict: false,
},
@@ -45,7 +39,6 @@ func TestForbidEnvironmentsWithReleases(t *testing.T) {
name: "no error when has --- between releases and environments, and --- on top of helmfile.yaml.gotmpl",
filePath: "helmfile.yaml",
content: []byte("---\nenvironments:\n---\nreleases:\n"),
v1mode: false,
expectedErr: false,
isStrict: false,
},
@@ -53,28 +46,13 @@ func TestForbidEnvironmentsWithReleases(t *testing.T) {
name: "error when both releases and environments",
filePath: "helmfile.yaml",
content: []byte("environments:\nreleases:\n"),
v1mode: false,
expectedErr: true,
isStrict: false,
},
{
name: "error when both releases and environments for plain yaml on v1",
filePath: "helmfile.yaml",
content: []byte("environments:\nreleases:\n"),
v1mode: true,
expectedErr: true,
isStrict: true,
},
}
v1mode := runtime.V1Mode
t.Cleanup(func() {
runtime.V1Mode = v1mode
})
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
runtime.V1Mode = tc.v1mode
isStrict, err := forbidEnvironmentsWithReleases(tc.filePath, tc.content)
require.Equal(t, tc.isStrict, isStrict, "expected isStrict=%v, got=%v", tc.isStrict, isStrict)
if tc.expectedErr {
@@ -153,26 +131,31 @@ func TestTopConfigKeysVerifier(t *testing.T) {
name: "error when not correct order 00",
helmfileContent: []byte("releases:\nbases:\n"),
wantErr: true,
wantStrict: true,
},
{
name: "error when not correct order 01",
helmfileContent: []byte("releases:\nhelmDefaults:\nbases:\n"),
wantErr: true,
wantStrict: true,
},
{
name: "error when not correct order 02",
helmfileContent: []byte("helmDefaults:\nreleases:\nbases:\n"),
wantErr: true,
wantStrict: true,
},
{
name: "error when not correct order 03",
helmfileContent: []byte("releases:\nva:\nve:\nbases:\n"),
wantErr: true,
wantStrict: true,
},
{
name: "error when not correct order 04",
helmfileContent: []byte("bases:\nreleases:\nenvironments:\n"),
wantErr: true,
wantStrict: true,
},
{
name: "no error when only has bases",