Files
cd/test/manifests_test.go
zeekay 31c64ef661 test, applicationset: drop Argo branding, fix bugs it was hiding
Rename test names, comments, fixture data, and mock GitHub/webhook
responses that still said Argo/ArgoCD/argocd/argoproj in our own
voice, matching the hanzocd-* binary/configmap names and the
apps.hanzo.ai CRD/annotation domain already established elsewhere
in the fork. Also drop the dated argov1alpha1/argoprojiov1alpha1
import aliases for our own v1alpha1 API package.

Restore the CRD groups a prior blind rename had mangled on a
vendored third-party Argo Workflows example manifest back to the
real argoproj.io, and fix several places where an earlier
half-finished rename had gone silently wrong instead of just being
cosmetic: stale CD_BINARY_NAME values and a stale
--argocd-repo-server flag no longer recognized by the binary, cert
filenames and an ssh_known_hosts alias that didn't match what's
actually on disk, a namespace and a kustomize image substitution
that were silent no-ops, and a test assertion regex that could
never match its own fixture.

External lookup keys we don't control are left byte-exact:
quay.io/argoprojlabs images, the docker.io/argoproj CI builder
image, live argoproj/argo-workflows release URLs, the generated
ArgoprojV1alpha1() clientset method, and the Makefile-coupled
/tmp/argo-e2e and GOPATH mount conventions.
2026-09-05 01:07:59 -07:00

49 lines
1.4 KiB
Go

package test
import (
"fmt"
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/hanzoai/cd/test/fixture/test"
cdexec "github.com/hanzoai/cd/util/exec"
)
func TestKustomizeVersion(t *testing.T) {
t.Parallel()
test.CIOnly(t)
out, err := cdexec.RunCommand("kustomize", cdexec.CmdOpts{}, "version")
require.NoError(t, err)
assert.Contains(t, out, "v5.", "kustomize should be version 5")
}
// TestBuildManifests makes sure we are consistent in naming, and all kustomization.yamls are buildable
func TestBuildManifests(t *testing.T) {
t.Parallel()
err := filepath.Walk("../manifests", func(path string, _ os.FileInfo, err error) error {
if err != nil {
return err
}
switch filepath.Base(path) {
case "kustomization.yaml":
// noop
case "Kustomization", "kustomization.yml":
// These are valid, but we want to be consistent with filenames
return fmt.Errorf("Please name file 'kustomization.yaml' instead of '%s'", filepath.Base(path))
case "Kustomize", "kustomize.yaml", "kustomize.yml":
// These are not even valid kustomization filenames but sometimes get mistaken for them
return fmt.Errorf("'%s' is not a valid kustomize name", filepath.Base(path))
default:
return nil
}
dirName := filepath.Dir(path)
_, err = cdexec.RunCommand("kustomize", cdexec.CmdOpts{}, "build", dirName)
return err
})
require.NoError(t, err)
}