mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
42 lines
882 B
Go
42 lines
882 B
Go
package util
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
|
|
)
|
|
|
|
var appSet = `apiVersion: argoproj.io/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) {
|
|
var appSets []*argoprojiov1alpha1.ApplicationSet
|
|
err := readAppset([]byte(appSet), &appSets)
|
|
if err != nil {
|
|
t.Logf("Failed reading appset file")
|
|
}
|
|
assert.Len(t, appSets, 1)
|
|
}
|