|
| 1 | +suite: test configmap |
| 2 | +templates: |
| 3 | + - configmap.yaml |
| 4 | +tests: |
| 5 | + - it: should render a ConfigMap |
| 6 | + asserts: |
| 7 | + - isKind: |
| 8 | + of: ConfigMap |
| 9 | + - equal: |
| 10 | + path: metadata.name |
| 11 | + value: RELEASE-NAME-marmot-config |
| 12 | + |
| 13 | + - it: should include config.yaml data key |
| 14 | + asserts: |
| 15 | + - isNotNull: |
| 16 | + path: data["config.yaml"] |
| 17 | + |
| 18 | + - it: should include default server config |
| 19 | + asserts: |
| 20 | + - matchRegex: |
| 21 | + path: data["config.yaml"] |
| 22 | + pattern: "port: 8080" |
| 23 | + - matchRegex: |
| 24 | + path: data["config.yaml"] |
| 25 | + pattern: "host: 0\\.0\\.0\\.0" |
| 26 | + |
| 27 | + - it: should include default logging config |
| 28 | + asserts: |
| 29 | + - matchRegex: |
| 30 | + path: data["config.yaml"] |
| 31 | + pattern: "level: info" |
| 32 | + - matchRegex: |
| 33 | + path: data["config.yaml"] |
| 34 | + pattern: "format: json" |
| 35 | + |
| 36 | + - it: should include default database config |
| 37 | + asserts: |
| 38 | + - matchRegex: |
| 39 | + path: data["config.yaml"] |
| 40 | + pattern: "host: postgresql" |
| 41 | + - matchRegex: |
| 42 | + path: data["config.yaml"] |
| 43 | + pattern: "sslmode: disable" |
| 44 | + |
| 45 | + - it: should NOT include Helm-only keys in ConfigMap |
| 46 | + asserts: |
| 47 | + - notMatchRegex: |
| 48 | + path: data["config.yaml"] |
| 49 | + pattern: "encryptionKeySecretRef" |
| 50 | + - notMatchRegex: |
| 51 | + path: data["config.yaml"] |
| 52 | + pattern: "autoGenerateEncryptionKey" |
| 53 | + - notMatchRegex: |
| 54 | + path: data["config.yaml"] |
| 55 | + pattern: "passwordSecretRef" |
| 56 | + - notMatchRegex: |
| 57 | + path: data["config.yaml"] |
| 58 | + pattern: "clientSecretRef" |
| 59 | + |
| 60 | + - it: should always use raw config.database values (subchart overrides are env vars) |
| 61 | + set: |
| 62 | + postgresql.enabled: true |
| 63 | + postgresql.auth.username: "testuser" |
| 64 | + postgresql.auth.database: "testdb" |
| 65 | + asserts: |
| 66 | + - matchRegex: |
| 67 | + path: data["config.yaml"] |
| 68 | + pattern: "host: postgresql" |
| 69 | + - matchRegex: |
| 70 | + path: data["config.yaml"] |
| 71 | + pattern: "user: marmot" |
| 72 | + |
| 73 | + - it: should include auth provider config without clientSecretRef |
| 74 | + set: |
| 75 | + config.auth.okta: |
| 76 | + enabled: true |
| 77 | + client_id: "my-client-id" |
| 78 | + clientSecretRef: |
| 79 | + name: "okta-secret" |
| 80 | + key: "client-secret" |
| 81 | + url: "https://test.okta.com" |
| 82 | + asserts: |
| 83 | + - matchRegex: |
| 84 | + path: data["config.yaml"] |
| 85 | + pattern: "client_id: my-client-id" |
| 86 | + - notMatchRegex: |
| 87 | + path: data["config.yaml"] |
| 88 | + pattern: "clientSecretRef" |
| 89 | + - notMatchRegex: |
| 90 | + path: data["config.yaml"] |
| 91 | + pattern: "okta-secret" |
| 92 | + |
| 93 | + - it: should strip elasticsearch passwordSecretRef from ConfigMap |
| 94 | + set: |
| 95 | + config.search.elasticsearch: |
| 96 | + enabled: true |
| 97 | + addresses: |
| 98 | + - "http://elasticsearch:9200" |
| 99 | + username: "elastic" |
| 100 | + passwordSecretRef: |
| 101 | + name: "es-secret" |
| 102 | + key: "password" |
| 103 | + index: "marmot" |
| 104 | + asserts: |
| 105 | + - matchRegex: |
| 106 | + path: data["config.yaml"] |
| 107 | + pattern: "username: elastic" |
| 108 | + - notMatchRegex: |
| 109 | + path: data["config.yaml"] |
| 110 | + pattern: "passwordSecretRef" |
| 111 | + - notMatchRegex: |
| 112 | + path: data["config.yaml"] |
| 113 | + pattern: "es-secret" |
| 114 | + |
| 115 | + - it: should include pipelines config |
| 116 | + asserts: |
| 117 | + - matchRegex: |
| 118 | + path: data["config.yaml"] |
| 119 | + pattern: "max_workers: 10" |
| 120 | + - matchRegex: |
| 121 | + path: data["config.yaml"] |
| 122 | + pattern: "scheduler_interval: 60" |
0 commit comments