|
| 1 | +suite: Test Hub Cluster Detection Additional Scenarios |
| 2 | +templates: |
| 3 | + - templates/policies/acm-hub-ca-policy.yaml |
| 4 | +release: |
| 5 | + name: release-test |
| 6 | +tests: |
| 7 | + # Test subdomain variations (domain-based detection) |
| 8 | + - it: should differentiate between similar domains |
| 9 | + set: |
| 10 | + global: |
| 11 | + repoURL: https://github.com/test/repo |
| 12 | + hubClusterDomain: "apps.hub.example.com" |
| 13 | + localClusterDomain: "apps.hub-spoke.example.com" # Similar but different |
| 14 | + secretStore: |
| 15 | + backend: "vault" |
| 16 | + pattern: "test-pattern" |
| 17 | + clusterGroup: |
| 18 | + isHubCluster: null # Explicitly unset to enable domain-based detection |
| 19 | + managedClusterGroups: |
| 20 | + test: |
| 21 | + name: test-cluster |
| 22 | + asserts: |
| 23 | + - hasDocuments: |
| 24 | + count: 0 |
| 25 | + |
| 26 | + # Test with special characters (domain-based detection) |
| 27 | + - it: should handle domains with special characters |
| 28 | + set: |
| 29 | + global: |
| 30 | + repoURL: https://github.com/test/repo |
| 31 | + hubClusterDomain: "apps.hub-cluster_1.example-domain.com" |
| 32 | + localClusterDomain: "apps.hub-cluster_1.example-domain.com" |
| 33 | + secretStore: |
| 34 | + backend: "vault" |
| 35 | + pattern: "test-pattern" |
| 36 | + clusterGroup: |
| 37 | + isHubCluster: null # Explicitly unset to enable domain-based detection |
| 38 | + managedClusterGroups: |
| 39 | + test: |
| 40 | + name: test-cluster |
| 41 | + asserts: |
| 42 | + - hasDocuments: |
| 43 | + count: 9 |
| 44 | + |
| 45 | + # Test with missing managedClusterGroups |
| 46 | + - it: should handle missing managedClusterGroups gracefully |
| 47 | + set: |
| 48 | + global: |
| 49 | + repoURL: https://github.com/test/repo |
| 50 | + hubClusterDomain: "apps.hub.example.com" |
| 51 | + localClusterDomain: "apps.hub.example.com" |
| 52 | + secretStore: |
| 53 | + backend: "vault" |
| 54 | + pattern: "test-pattern" |
| 55 | + clusterGroup: |
| 56 | + isHubCluster: null # Explicitly unset to enable domain-based detection |
| 57 | + managedClusterGroups: null # Explicitly unset |
| 58 | + asserts: |
| 59 | + - hasDocuments: |
| 60 | + count: 0 # No managed cluster groups means no policies |
| 61 | + |
| 62 | + # Test with empty managedClusterGroups |
| 63 | + - it: should handle empty managedClusterGroups |
| 64 | + set: |
| 65 | + global: |
| 66 | + repoURL: https://github.com/test/repo |
| 67 | + hubClusterDomain: "apps.hub.example.com" |
| 68 | + localClusterDomain: "apps.hub.example.com" |
| 69 | + secretStore: |
| 70 | + backend: "vault" |
| 71 | + pattern: "test-pattern" |
| 72 | + clusterGroup: |
| 73 | + isHubCluster: null # Explicitly unset to enable domain-based detection |
| 74 | + managedClusterGroups: {} # Empty |
| 75 | + asserts: |
| 76 | + - hasDocuments: |
| 77 | + count: 0 # Empty managed cluster groups means no policies |
| 78 | + |
| 79 | + # Test explicit isHubCluster takes precedence over domain-based detection |
| 80 | + - it: should respect explicit isHubCluster even when domains match |
| 81 | + set: |
| 82 | + global: |
| 83 | + repoURL: https://github.com/test/migration |
| 84 | + hubClusterDomain: "apps.migration-hub.example.com" |
| 85 | + localClusterDomain: "apps.migration-hub.example.com" |
| 86 | + secretStore: |
| 87 | + backend: "vault" |
| 88 | + pattern: "migration-test" |
| 89 | + clusterGroup: |
| 90 | + # Explicit isHubCluster takes precedence over domain-based detection |
| 91 | + isHubCluster: false # Explicitly set to false, should be respected |
| 92 | + managedClusterGroups: |
| 93 | + migrationTarget: |
| 94 | + name: migration-target |
| 95 | + labels: |
| 96 | + - name: migration |
| 97 | + value: in-progress |
| 98 | + asserts: |
| 99 | + # Explicit isHubCluster: false is respected even though domains match |
| 100 | + - hasDocuments: |
| 101 | + count: 0 |
| 102 | + |
| 103 | + # Test multiple cluster groups with domain-based logic (no explicit isHubCluster) |
| 104 | + - it: should handle multiple cluster groups with domain-based hub detection |
| 105 | + set: |
| 106 | + global: |
| 107 | + repoURL: https://github.com/test/multi-cluster |
| 108 | + hubClusterDomain: "apps.prod-hub.company.com" |
| 109 | + localClusterDomain: "apps.prod-hub.company.com" |
| 110 | + secretStore: |
| 111 | + backend: "vault" |
| 112 | + pattern: "multi-cluster-test" |
| 113 | + clusterGroup: |
| 114 | + isHubCluster: null # Explicitly unset to enable domain-based detection |
| 115 | + managedClusterGroups: |
| 116 | + prodEast: |
| 117 | + name: prod-east |
| 118 | + labels: |
| 119 | + - name: environment |
| 120 | + value: production |
| 121 | + stagingWest: |
| 122 | + name: staging-west |
| 123 | + labels: |
| 124 | + - name: environment |
| 125 | + value: staging |
| 126 | + asserts: |
| 127 | + # Should have CA policies for 2 cluster groups (9 docs each) |
| 128 | + - hasDocuments: |
| 129 | + count: 18 |
| 130 | + # Verify specific policies exist |
| 131 | + - documentSelector: |
| 132 | + path: metadata.name |
| 133 | + value: hub-argo-ca-prod-east-policy |
| 134 | + isKind: |
| 135 | + of: Policy |
| 136 | + - documentSelector: |
| 137 | + path: metadata.name |
| 138 | + value: hub-argo-ca-staging-west-policy |
| 139 | + isKind: |
| 140 | + of: Policy |
0 commit comments