Skip to content

Commit

Permalink
Add some unit tests for namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaldessari authored and Martin Jackson committed Oct 30, 2024
1 parent 308706a commit 739c824
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions tests/namespaces_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
suite: Test namespace with default values
templates:
- templates/core/namespaces.yaml
release:
name: release-test
tests:
- it: should output nothing by default
asserts:
- hasDocuments:
count: 0

- it: should output namespaces when defined as list
set:
global:
pattern: test
clusterGroup:
name: hub
namespaces:
- foo
- bar
- baz
asserts:
- isKind:
of: Namespace
- hasDocuments:
count: 3
- documentSelector:
path: metadata.name
value: bar
equal:
path: metadata.labels["argocd.argoproj.io/managed-by"]
value: test-hub

- it: should output namespaces when defined as map
set:
global:
pattern: test
clusterGroup:
name: hub
namespaces:
namespace1:
open-cluster-management:
labels:
openshift.io/node-selector: ""
kubernetes.io/os: linux
annotations:
openshift.io/cluster-monitoring: "true"
owner: "namespace owner"
asserts:
- isKind:
of: Namespace
- hasDocuments:
count: 2
- documentSelector:
path: metadata.name
value: open-cluster-management
equal:
path: metadata.annotations["openshift.io/cluster-monitoring"]
value: "true"

0 comments on commit 739c824

Please sign in to comment.