|
| 1 | +suite: cloud provider configuration tests |
| 2 | +templates: |
| 3 | + - controller.yaml |
| 4 | + - secret.yaml |
| 5 | +values: |
| 6 | + - values.yaml |
| 7 | +tests: |
| 8 | + - it: should not include --cloud-provider arg when neither extraArgs nor global is set |
| 9 | + asserts: |
| 10 | + - notContains: |
| 11 | + path: spec.template.spec.containers[0].args |
| 12 | + content: "--cloud-provider=gcp" |
| 13 | + template: controller.yaml |
| 14 | + documentIndex: 0 |
| 15 | + - notContains: |
| 16 | + path: spec.template.spec.containers[0].args |
| 17 | + content: "--cloud-provider=gke" |
| 18 | + template: controller.yaml |
| 19 | + documentIndex: 0 |
| 20 | + - notContains: |
| 21 | + path: spec.template.spec.containers[0].args |
| 22 | + content: "--cloud-provider=aws" |
| 23 | + template: controller.yaml |
| 24 | + documentIndex: 0 |
| 25 | + - notContains: |
| 26 | + path: spec.template.spec.containers[0].args |
| 27 | + content: "--cloud-provider=eks" |
| 28 | + template: controller.yaml |
| 29 | + documentIndex: 0 |
| 30 | + - notContains: |
| 31 | + path: spec.template.spec.containers[0].args |
| 32 | + content: "--cloud-provider=azure" |
| 33 | + template: controller.yaml |
| 34 | + documentIndex: 0 |
| 35 | + - notContains: |
| 36 | + path: spec.template.spec.containers[0].args |
| 37 | + content: "--cloud-provider=aks" |
| 38 | + template: controller.yaml |
| 39 | + documentIndex: 0 |
| 40 | + |
| 41 | + - it: should use global.castai.provider as fallback |
| 42 | + set: |
| 43 | + global.castai.provider: eks |
| 44 | + asserts: |
| 45 | + - contains: |
| 46 | + path: spec.template.spec.containers[0].args |
| 47 | + content: "--cloud-provider=eks" |
| 48 | + template: controller.yaml |
| 49 | + documentIndex: 0 |
| 50 | + |
| 51 | + - it: should prefer extraArgs.cloud-provider over global |
| 52 | + set: |
| 53 | + global.castai.provider: eks |
| 54 | + controller.extraArgs.cloud-provider: gcp |
| 55 | + asserts: |
| 56 | + - contains: |
| 57 | + path: spec.template.spec.containers[0].args |
| 58 | + content: "--cloud-provider=gcp" |
| 59 | + template: controller.yaml |
| 60 | + documentIndex: 0 |
| 61 | + - notContains: |
| 62 | + path: spec.template.spec.containers[0].args |
| 63 | + content: "--cloud-provider=eks" |
| 64 | + template: controller.yaml |
| 65 | + documentIndex: 0 |
| 66 | + |
| 67 | + - it: should use extraArgs.cloud-provider when global is not set |
| 68 | + set: |
| 69 | + controller.extraArgs.cloud-provider: aws |
| 70 | + asserts: |
| 71 | + - contains: |
| 72 | + path: spec.template.spec.containers[0].args |
| 73 | + content: "--cloud-provider=aws" |
| 74 | + template: controller.yaml |
| 75 | + documentIndex: 0 |
| 76 | + |
| 77 | + - it: should use global.castai.provider as fallback for azure |
| 78 | + set: |
| 79 | + global.castai.provider: azure |
| 80 | + asserts: |
| 81 | + - contains: |
| 82 | + path: spec.template.spec.containers[0].args |
| 83 | + content: "--cloud-provider=azure" |
| 84 | + template: controller.yaml |
| 85 | + documentIndex: 0 |
| 86 | + |
| 87 | + - it: should not include --cloud-provider arg when global.castai.provider is empty string |
| 88 | + set: |
| 89 | + global.castai.provider: "" |
| 90 | + asserts: |
| 91 | + - notContains: |
| 92 | + path: spec.template.spec.containers[0].args |
| 93 | + content: "--cloud-provider=gcp" |
| 94 | + template: controller.yaml |
| 95 | + documentIndex: 0 |
| 96 | + - notContains: |
| 97 | + path: spec.template.spec.containers[0].args |
| 98 | + content: "--cloud-provider=gke" |
| 99 | + template: controller.yaml |
| 100 | + documentIndex: 0 |
| 101 | + - notContains: |
| 102 | + path: spec.template.spec.containers[0].args |
| 103 | + content: "--cloud-provider=aws" |
| 104 | + template: controller.yaml |
| 105 | + documentIndex: 0 |
| 106 | + - notContains: |
| 107 | + path: spec.template.spec.containers[0].args |
| 108 | + content: "--cloud-provider=eks" |
| 109 | + template: controller.yaml |
| 110 | + documentIndex: 0 |
| 111 | + - notContains: |
| 112 | + path: spec.template.spec.containers[0].args |
| 113 | + content: "--cloud-provider=azure" |
| 114 | + template: controller.yaml |
| 115 | + documentIndex: 0 |
| 116 | + - notContains: |
| 117 | + path: spec.template.spec.containers[0].args |
| 118 | + content: "--cloud-provider=aks" |
| 119 | + template: controller.yaml |
| 120 | + documentIndex: 0 |
| 121 | + |
| 122 | + - it: should not include --cloud-provider arg when other extraArgs are set but neither cloud-provider nor global is set |
| 123 | + set: |
| 124 | + controller.extraArgs: |
| 125 | + log-level: debug |
| 126 | + asserts: |
| 127 | + - notContains: |
| 128 | + path: spec.template.spec.containers[0].args |
| 129 | + content: "--cloud-provider=gcp" |
| 130 | + template: controller.yaml |
| 131 | + documentIndex: 0 |
| 132 | + - notContains: |
| 133 | + path: spec.template.spec.containers[0].args |
| 134 | + content: "--cloud-provider=gke" |
| 135 | + template: controller.yaml |
| 136 | + documentIndex: 0 |
| 137 | + - notContains: |
| 138 | + path: spec.template.spec.containers[0].args |
| 139 | + content: "--cloud-provider=aws" |
| 140 | + template: controller.yaml |
| 141 | + documentIndex: 0 |
| 142 | + - notContains: |
| 143 | + path: spec.template.spec.containers[0].args |
| 144 | + content: "--cloud-provider=eks" |
| 145 | + template: controller.yaml |
| 146 | + documentIndex: 0 |
| 147 | + - notContains: |
| 148 | + path: spec.template.spec.containers[0].args |
| 149 | + content: "--cloud-provider=azure" |
| 150 | + template: controller.yaml |
| 151 | + documentIndex: 0 |
| 152 | + - notContains: |
| 153 | + path: spec.template.spec.containers[0].args |
| 154 | + content: "--cloud-provider=aks" |
| 155 | + template: controller.yaml |
| 156 | + documentIndex: 0 |
| 157 | + - contains: |
| 158 | + path: spec.template.spec.containers[0].args |
| 159 | + content: "--log-level=debug" |
| 160 | + template: controller.yaml |
| 161 | + documentIndex: 0 |
| 162 | + |
| 163 | + - it: should pass through other extraArgs unchanged |
| 164 | + set: |
| 165 | + global.castai.provider: eks |
| 166 | + controller.extraArgs: |
| 167 | + log-level: debug |
| 168 | + image-scan-enabled: "true" |
| 169 | + asserts: |
| 170 | + - contains: |
| 171 | + path: spec.template.spec.containers[0].args |
| 172 | + content: "--cloud-provider=eks" |
| 173 | + template: controller.yaml |
| 174 | + documentIndex: 0 |
| 175 | + - contains: |
| 176 | + path: spec.template.spec.containers[0].args |
| 177 | + content: "--log-level=debug" |
| 178 | + template: controller.yaml |
| 179 | + documentIndex: 0 |
| 180 | + - contains: |
| 181 | + path: spec.template.spec.containers[0].args |
| 182 | + content: "--image-scan-enabled=true" |
| 183 | + template: controller.yaml |
| 184 | + documentIndex: 0 |
0 commit comments