Skip to content

Commit

Permalink
create apps and assert pass
Browse files Browse the repository at this point in the history
Signed-off-by: Atif Ali <[email protected]>
  • Loading branch information
aali309 committed Jan 29, 2025
1 parent e24cbe6 commit 7ecff26
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 17 deletions.
40 changes: 28 additions & 12 deletions tests/k8s/1-046_validate_application_tracking/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
metadata:
name: assert-apps
timeout: 300
---
# Check first Application exists
apiVersion: argoproj.io/v1alpha1
kind: Application
# Check first namespace labels
apiVersion: v1
kind: Namespace
metadata:
name: source-ns-1
labels:
argocd.argoproj.io/managed-by: test-1-046-argocd-1
argocd.argoproj.io/tracking-id: instance-1
---
# Check second namespace labels
apiVersion: v1
kind: Namespace
metadata:
name: source-ns-2
labels:
argocd.argoproj.io/managed-by: test-1-046-argocd-2
argocd.argoproj.io/tracking-id: instance-2
---
# Verify RBAC is set up for first namespace
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: test-app
namespace: test-1-046-argocd-1
name: argocd-1-argocd-application-controller
namespace: source-ns-1
---
# Check second Application exists
apiVersion: argoproj.io/v1alpha1
kind: Application
# Verify RBAC is set up for second namespace
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: test-app
namespace: test-1-046-argocd-2
name: argocd-2-argocd-application-controller
namespace: source-ns-2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
# Set managed-by labels
- script: |
kubectl label ns source-ns-1 argocd.argoproj.io/managed-by=test-1-046-argocd-1
kubectl label ns source-ns-2 argocd.argoproj.io/managed-by=test-1-046-argocd-2
sleep 30
# Set tracking-id labels
- script: |
kubectl label ns source-ns-1 argocd.argoproj.io/tracking-id=instance-1
kubectl label ns source-ns-2 argocd.argoproj.io/tracking-id=instance-2
sleep 30
27 changes: 27 additions & 0 deletions tests/k8s/1-046_validate_application_tracking/03-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 300
---
# Check first Application is healthy
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: test-app
namespace: test-1-046-argocd-1
status:
health:
status: Healthy
sync:
status: Synced
---
# Check second Application is healthy
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: test-app
namespace: test-1-046-argocd-2
status:
health:
status: Healthy
sync:
status: Synced
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This creates an application with a destination in the other managed namespace
# Application in first ArgoCD instance
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
Expand All @@ -9,13 +9,14 @@ spec:
source:
repoURL: https://github.com/redhat-developer/gitops-operator
path: test/examples/nginx
targetRevision: "HEAD"
targetRevision: HEAD
destination:
server: "https://kubernetes.default.svc"
server: https://kubernetes.default.svc
namespace: source-ns-1
syncPolicy:
automated: {}
---
# Application in second ArgoCD instance
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
Expand All @@ -26,9 +27,9 @@ spec:
source:
repoURL: https://github.com/redhat-developer/gitops-operator
path: test/examples/nginx
targetRevision: "HEAD"
targetRevision: HEAD
destination:
server: "https://kubernetes.default.svc"
server: https://kubernetes.default.svc
namespace: source-ns-2
syncPolicy:
automated: {}

0 comments on commit 7ecff26

Please sign in to comment.