|
| 1 | +suite: Test LAGO_MEILISEARCH_SEARCH_ENABLED projection |
| 2 | +templates: |
| 3 | + - templates/deployment.yaml |
| 4 | +values: |
| 5 | + - ../values.yaml |
| 6 | + |
| 7 | +# Common values that any deployment render needs; parked here so each |
| 8 | +# test doesn't re-set them. |
| 9 | +set: |
| 10 | + global.meilisearch.enabled: true |
| 11 | + global.meilisearch.url: "http://meilisearch.meilisearch.svc.cluster.local:7700" |
| 12 | + global.meilisearch.apiKey: "test-key" |
| 13 | + |
| 14 | +tests: |
| 15 | + # ============================================================================ |
| 16 | + # global.meilisearch.search |
| 17 | + # ============================================================================ |
| 18 | + - it: should project LAGO_MEILISEARCH_SEARCH_ENABLED="true" by default |
| 19 | + values: |
| 20 | + - ./fixtures/required.yaml |
| 21 | + asserts: |
| 22 | + - contains: |
| 23 | + path: spec.template.spec.containers[0].env |
| 24 | + content: |
| 25 | + name: LAGO_MEILISEARCH_SEARCH_ENABLED |
| 26 | + value: "true" |
| 27 | + |
| 28 | + - it: should project LAGO_MEILISEARCH_SEARCH_ENABLED="false" when global.meilisearch.search=false |
| 29 | + values: |
| 30 | + - ./fixtures/required.yaml |
| 31 | + set: |
| 32 | + global.meilisearch.search: false |
| 33 | + asserts: |
| 34 | + - contains: |
| 35 | + path: spec.template.spec.containers[0].env |
| 36 | + content: |
| 37 | + name: LAGO_MEILISEARCH_SEARCH_ENABLED |
| 38 | + value: "false" |
| 39 | + |
| 40 | + # LAGO_MEILISEARCH_URL and LAGO_MEILISEARCH_API_KEY stay wired even when |
| 41 | + # search is false — the workload can still hit Meilisearch for |
| 42 | + # non-search paths (e.g. indexing from a worker); only the read-side is |
| 43 | + # disabled. |
| 44 | + - it: should still project URL + API_KEY when search=false |
| 45 | + values: |
| 46 | + - ./fixtures/required.yaml |
| 47 | + set: |
| 48 | + global.meilisearch.search: false |
| 49 | + asserts: |
| 50 | + - contains: |
| 51 | + path: spec.template.spec.containers[0].env |
| 52 | + content: |
| 53 | + name: LAGO_MEILISEARCH_URL |
| 54 | + valueFrom: |
| 55 | + configMapKeyRef: |
| 56 | + name: RELEASE-NAME-lago-config |
| 57 | + key: meilisearch.endpoint |
| 58 | + - contains: |
| 59 | + path: spec.template.spec.containers[0].env |
| 60 | + content: |
| 61 | + name: LAGO_MEILISEARCH_API_KEY |
| 62 | + valueFrom: |
| 63 | + secretKeyRef: |
| 64 | + name: RELEASE-NAME-lago-config |
| 65 | + key: meilisearch.apiKey |
| 66 | + |
| 67 | + # When Meilisearch is globally disabled, the whole env block is elided |
| 68 | + # regardless of `search`. |
| 69 | + - it: should not project the block when global.meilisearch.enabled=false |
| 70 | + values: |
| 71 | + - ./fixtures/required.yaml |
| 72 | + set: |
| 73 | + global.meilisearch.enabled: false |
| 74 | + asserts: |
| 75 | + - notContains: |
| 76 | + path: spec.template.spec.containers[0].env |
| 77 | + content: |
| 78 | + name: LAGO_MEILISEARCH_SEARCH_ENABLED |
| 79 | + - notContains: |
| 80 | + path: spec.template.spec.containers[0].env |
| 81 | + content: |
| 82 | + name: LAGO_MEILISEARCH_URL |
0 commit comments