|
| 1 | +suite: networking.multus.resources bundle wiring |
| 2 | +templates: |
| 3 | + - templates/bundles/system.yaml |
| 4 | +release: |
| 5 | + name: cozystack |
| 6 | + namespace: cozy-system |
| 7 | +tests: |
| 8 | + # Unset leaves the multus chart default in charge rather than freezing a copy |
| 9 | + # of it into every Package. |
| 10 | + - it: passes no resources when the key is unset |
| 11 | + set: |
| 12 | + bundles: |
| 13 | + system: |
| 14 | + enabled: true |
| 15 | + variant: isp-full |
| 16 | + documentSelector: |
| 17 | + path: metadata.name |
| 18 | + value: cozystack.multus |
| 19 | + asserts: |
| 20 | + - notExists: |
| 21 | + path: spec.components.multus.values.resources |
| 22 | + - equal: |
| 23 | + path: spec.components.multus.values.stageCniPlugins |
| 24 | + value: true |
| 25 | + |
| 26 | + - it: passes an override on talos next to stageCniPlugins |
| 27 | + set: |
| 28 | + bundles: |
| 29 | + system: |
| 30 | + enabled: true |
| 31 | + variant: isp-full |
| 32 | + networking: |
| 33 | + multus: |
| 34 | + resources: |
| 35 | + limits: |
| 36 | + memory: 8Gi |
| 37 | + documentSelector: |
| 38 | + path: metadata.name |
| 39 | + value: cozystack.multus |
| 40 | + asserts: |
| 41 | + - equal: |
| 42 | + path: spec.components.multus.values |
| 43 | + value: |
| 44 | + stageCniPlugins: true |
| 45 | + resources: |
| 46 | + limits: |
| 47 | + memory: 8Gi |
| 48 | + |
| 49 | + - it: passes an override on generic Linux |
| 50 | + set: |
| 51 | + bundles: |
| 52 | + system: |
| 53 | + enabled: true |
| 54 | + variant: isp-full-generic |
| 55 | + networking: |
| 56 | + multus: |
| 57 | + resources: |
| 58 | + requests: |
| 59 | + cpu: 500m |
| 60 | + documentSelector: |
| 61 | + path: metadata.name |
| 62 | + value: cozystack.multus |
| 63 | + asserts: |
| 64 | + - equal: |
| 65 | + path: spec.components.multus.values.resources |
| 66 | + value: |
| 67 | + requests: |
| 68 | + cpu: 500m |
| 69 | + |
| 70 | + - it: passes an override when multus is opted in on a slim variant |
| 71 | + values: |
| 72 | + - ../values-isp-slim-generic.yaml |
| 73 | + set: |
| 74 | + bundles: |
| 75 | + enabledPackages: |
| 76 | + - cozystack.multus |
| 77 | + networking: |
| 78 | + multus: |
| 79 | + resources: |
| 80 | + limits: |
| 81 | + memory: 8Gi |
| 82 | + documentSelector: |
| 83 | + path: metadata.name |
| 84 | + value: cozystack.multus |
| 85 | + asserts: |
| 86 | + - equal: |
| 87 | + path: spec.components.multus.values.resources.limits.memory |
| 88 | + value: 8Gi |
| 89 | + |
| 90 | + - it: reads an explicit null as unset |
| 91 | + set: |
| 92 | + bundles: |
| 93 | + system: |
| 94 | + enabled: true |
| 95 | + variant: isp-full |
| 96 | + networking: |
| 97 | + multus: |
| 98 | + resources: null |
| 99 | + documentSelector: |
| 100 | + path: metadata.name |
| 101 | + value: cozystack.multus |
| 102 | + asserts: |
| 103 | + - notExists: |
| 104 | + path: spec.components.multus.values.resources |
| 105 | + |
| 106 | + - it: refuses resources that are not a map |
| 107 | + set: |
| 108 | + bundles: |
| 109 | + system: |
| 110 | + enabled: true |
| 111 | + variant: isp-full |
| 112 | + networking: |
| 113 | + multus: |
| 114 | + resources: 4Gi |
| 115 | + asserts: |
| 116 | + - failedTemplate: |
| 117 | + errorMessage: 'networking.multus.resources: expected a map, got string' |
| 118 | + |
| 119 | + # An uncommented `multus:` with nothing under it arrives as null. |
| 120 | + - it: reads a null multus block as unset |
| 121 | + set: |
| 122 | + bundles: |
| 123 | + system: |
| 124 | + enabled: true |
| 125 | + variant: isp-full |
| 126 | + networking: |
| 127 | + multus: null |
| 128 | + documentSelector: |
| 129 | + path: metadata.name |
| 130 | + value: cozystack.multus |
| 131 | + asserts: |
| 132 | + - notExists: |
| 133 | + path: spec.components.multus.values.resources |
| 134 | + |
| 135 | + # false is the spelling most likely to mean "turn multus off", which this key |
| 136 | + # does not do, so it must not pass as unset. |
| 137 | + - it: refuses a multus block that is not a map |
| 138 | + set: |
| 139 | + bundles: |
| 140 | + system: |
| 141 | + enabled: true |
| 142 | + variant: isp-full |
| 143 | + networking: |
| 144 | + multus: false |
| 145 | + asserts: |
| 146 | + - failedTemplate: |
| 147 | + errorMessage: 'networking.multus: expected a map, got bool' |
0 commit comments