mirror of
https://github.com/hanzoai/cd.git
synced 2026-10-30 14:56:45 +00:00
Local identifiers (argoClientSet/argoDB/argoappv1/isArgoCDConfigMap etc.), comments, and log/help text renamed to our own voice across the cd, cd-server, cd-applicationset-controller, and util binaries. Left the generated ArgoprojV1alpha1 clientset accessor and OAuth client-id constants untouched (external contract). Fixed two stale test fixtures that were silently broken by an earlier partial rename (cluster_test.go's hostnames, app_test.go's TestTruncateString expectation).
43 lines
862 B
Go
43 lines
862 B
Go
package util
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
appv1 "github.com/hanzoai/cd/pkg/apis/application/v1alpha1"
|
|
)
|
|
|
|
var appSet = `apiVersion: apps.hanzo.ai/v1alpha1
|
|
kind: ApplicationSet
|
|
metadata:
|
|
name: guestbook
|
|
spec:
|
|
generators:
|
|
- list:
|
|
elements:
|
|
- cluster: engineering-dev
|
|
url: https://1.2.3.4
|
|
template:
|
|
metadata:
|
|
name: '{{cluster}}-guestbook'
|
|
spec:
|
|
source:
|
|
repoURL: https://github.com/infra-team/cluster-deployments.git
|
|
targetRevision: HEAD
|
|
path: guestbook/{{cluster}}
|
|
destination:
|
|
server: '{{url}}'
|
|
namespace: guestbook
|
|
`
|
|
|
|
func TestReadAppSet(t *testing.T) {
|
|
t.Parallel()
|
|
var appSets []*appv1.ApplicationSet
|
|
err := readAppset([]byte(appSet), &appSets)
|
|
if err != nil {
|
|
t.Log("Failed reading appset file")
|
|
}
|
|
assert.Len(t, appSets, 1)
|
|
}
|