Files
cd/util/helm/index_test.go
zeekay ba8f5f95c0 util/kustomize, util/helm: fix a stale env var check, drop placeholders
The custom-kustomize-binary test fixture grepped for ARGOCD_APP_NAME,
but the parameter injection code sets CD_APP_NAME, so the check
always came up empty and TestKustomizeCustomVersion failed. Also
replaced argo-cd/argo-cd-tests placeholder label and env values in
kustomize_test.go, and the argo-cd chart-index key in
util/helm/index_test.go, with our own naming.

Left alone: util/helm/client_test.go's calls against the real,
live argoproj.github.io/argo-helm chart repo and its published
argo-cd chart (0.7.1) -- an actual network integration test, not
branding text.
2026-09-05 01:04:16 -07:00

40 lines
775 B
Go

package helm
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
var index = Index{
Entries: map[string]Entries{
"cd": {
{Version: "~0.7.3"},
{Version: "0.7.1"},
{Version: "0.5.4"},
{Version: "0.5.3"},
{Version: "0.7.2"},
{Version: "0.5.2"},
{Version: "~0.5.2"},
{Version: "0.5.1"},
{Version: "0.5.0"},
},
},
}
func TestIndex_GetEntries(t *testing.T) {
t.Parallel()
t.Run("NotFound", func(t *testing.T) {
t.Parallel()
_, err := index.GetEntries("foo")
require.EqualError(t, err, "chart 'foo' not found in index")
})
t.Run("Found", func(t *testing.T) {
t.Parallel()
ts, err := index.GetEntries("cd")
require.NoError(t, err)
assert.Len(t, ts, len(index.Entries["cd"]))
})
}