|
| 1 | +# Copyright IBM Corp. 2026 |
| 2 | + |
| 3 | +suite: Test Worker OpenShift Route Configuration |
| 4 | +templates: |
| 5 | + - worker-route.yaml |
| 6 | +tests: |
| 7 | + # ============================================================================ |
| 8 | + # ROUTE NOT RENDERED ON VANILLA KUBERNETES |
| 9 | + # ============================================================================ |
| 10 | + |
| 11 | + - it: should not render a Route when openshift.enabled is false |
| 12 | + set: |
| 13 | + openshift.enabled: false |
| 14 | + openshift.route.proxy.enabled: true |
| 15 | + asserts: |
| 16 | + - hasDocuments: |
| 17 | + count: 0 |
| 18 | + |
| 19 | + - it: should not render a Route when openshift.route.proxy.enabled is false |
| 20 | + set: |
| 21 | + openshift.enabled: true |
| 22 | + openshift.route.proxy.enabled: false |
| 23 | + asserts: |
| 24 | + - hasDocuments: |
| 25 | + count: 0 |
| 26 | + |
| 27 | + - it: should not render a Route when both flags are false |
| 28 | + set: |
| 29 | + openshift.enabled: false |
| 30 | + openshift.route.proxy.enabled: false |
| 31 | + asserts: |
| 32 | + - hasDocuments: |
| 33 | + count: 0 |
| 34 | + |
| 35 | + # ============================================================================ |
| 36 | + # ROUTE RENDERED ON OPENSHIFT |
| 37 | + # ============================================================================ |
| 38 | + |
| 39 | + - it: should render a Route when openshift.enabled and route.proxy.enabled are true |
| 40 | + set: |
| 41 | + openshift.enabled: true |
| 42 | + openshift.route.proxy.enabled: true |
| 43 | + asserts: |
| 44 | + - hasDocuments: |
| 45 | + count: 1 |
| 46 | + - isAPIVersion: |
| 47 | + of: route.openshift.io/v1 |
| 48 | + - isKind: |
| 49 | + of: Route |
| 50 | + |
| 51 | + - it: should use passthrough TLS termination by default |
| 52 | + set: |
| 53 | + openshift.enabled: true |
| 54 | + openshift.route.proxy.enabled: true |
| 55 | + asserts: |
| 56 | + - equal: |
| 57 | + path: spec.tls.termination |
| 58 | + value: passthrough |
| 59 | + |
| 60 | + - it: should allow edge TLS termination override |
| 61 | + set: |
| 62 | + openshift.enabled: true |
| 63 | + openshift.route.proxy.enabled: true |
| 64 | + openshift.route.proxy.tls.termination: edge |
| 65 | + asserts: |
| 66 | + - equal: |
| 67 | + path: spec.tls.termination |
| 68 | + value: edge |
| 69 | + |
| 70 | + - it: should not set spec.host when host is empty |
| 71 | + set: |
| 72 | + openshift.enabled: true |
| 73 | + openshift.route.proxy.enabled: true |
| 74 | + openshift.route.proxy.host: "" |
| 75 | + asserts: |
| 76 | + - isNull: |
| 77 | + path: spec.host |
| 78 | + |
| 79 | + - it: should set spec.host when a custom host is provided |
| 80 | + set: |
| 81 | + openshift.enabled: true |
| 82 | + openshift.route.proxy.enabled: true |
| 83 | + openshift.route.proxy.host: "boundary.apps.cluster.example.com" |
| 84 | + asserts: |
| 85 | + - equal: |
| 86 | + path: spec.host |
| 87 | + value: "boundary.apps.cluster.example.com" |
| 88 | + |
| 89 | + - it: should target the proxy service |
| 90 | + release: |
| 91 | + name: my-worker |
| 92 | + set: |
| 93 | + openshift.enabled: true |
| 94 | + openshift.route.proxy.enabled: true |
| 95 | + asserts: |
| 96 | + - equal: |
| 97 | + path: spec.to.kind |
| 98 | + value: Service |
| 99 | + - equal: |
| 100 | + path: spec.to.name |
| 101 | + value: my-worker-proxy |
| 102 | + - equal: |
| 103 | + path: spec.port.targetPort |
| 104 | + value: proxy |
| 105 | + |
| 106 | + - it: should apply route annotations when provided |
| 107 | + set: |
| 108 | + openshift.enabled: true |
| 109 | + openshift.route.proxy.enabled: true |
| 110 | + openshift.route.proxy.annotations: |
| 111 | + haproxy.router.openshift.io/timeout: "2h" |
| 112 | + asserts: |
| 113 | + - equal: |
| 114 | + path: metadata.annotations["haproxy.router.openshift.io/timeout"] |
| 115 | + value: "2h" |
| 116 | + |
| 117 | + - it: should use the release namespace |
| 118 | + release: |
| 119 | + namespace: boundary-prod |
| 120 | + set: |
| 121 | + openshift.enabled: true |
| 122 | + openshift.route.proxy.enabled: true |
| 123 | + asserts: |
| 124 | + - equal: |
| 125 | + path: metadata.namespace |
| 126 | + value: boundary-prod |
| 127 | + |
| 128 | + - it: should carry standard labels |
| 129 | + set: |
| 130 | + openshift.enabled: true |
| 131 | + openshift.route.proxy.enabled: true |
| 132 | + asserts: |
| 133 | + - equal: |
| 134 | + path: metadata.labels["app.kubernetes.io/component"] |
| 135 | + value: worker |
| 136 | + - isNotNull: |
| 137 | + path: metadata.labels["helm.sh/chart"] |
| 138 | + - isNotNull: |
| 139 | + path: metadata.labels["app.kubernetes.io/name"] |
0 commit comments