openbao-helm/test/unit/schema.bats
Christopher Swenson 710915952e
VAULT-571 Matching documented behavior and consul (#703)
VAULT-571 Matching documented behavior and consul

Consul's helm template defaults most of the enabled to the special value
`"-"`, which means to inherit from global. This is what is implied
should happen in Vault as well according to the documentation for the
helm chart:

> [global.enabled] The master enabled/disabled configuration. If this is
> true, most components will be installed by default. If this is false,
> no components will be installed by default and manually opting-in is
> required, such as by setting server.enabled to true.

(https://www.vaultproject.io/docs/platform/k8s/helm/configuration#enabled)

We also simplified the chart logic using a few template helpers.

Co-authored-by: Theron Voran <tvoran@users.noreply.github.com>
2022-03-21 09:50:23 -07:00

46 lines
1.4 KiB
Bash

#!/usr/bin/env bats
load _helpers
# These tests are just to verify there is a schema file used in the chart. Since
# .enabled is defined as a boolean type for each of the top-level blocks in the
# schema, setting it as a string fails 'helm template'.
@test "schema: csi enabled datatype" {
cd `chart_dir`
run helm template . --set csi.enabled="123"
[ "$status" -eq 1 ]
[ "${lines[2]}" = "- csi.enabled: Invalid type. Expected: [boolean,string], given: integer" ]
run helm template . --set csi.enabled=true
[ "$status" -eq 0 ]
}
@test "schema: injector enabled datatype" {
cd `chart_dir`
run helm template . --set injector.enabled="123"
[ "$status" -eq 1 ]
[ "${lines[2]}" = "- injector.enabled: Invalid type. Expected: [boolean,string], given: integer" ]
run helm template . --set injector.enabled=true
[ "$status" -eq 0 ]
}
@test "schema: server enabled datatype" {
cd `chart_dir`
run helm template . --set server.enabled="123"
[ "$status" -eq 1 ]
[ "${lines[2]}" = "- server.enabled: Invalid type. Expected: [boolean,string], given: integer" ]
run helm template . --set server.enabled=true
[ "$status" -eq 0 ]
}
@test "schema: ui enabled datatype" {
cd `chart_dir`
run helm template . --set ui.enabled="123"
[ "$status" -eq 1 ]
[ "${lines[2]}" = "- ui.enabled: Invalid type. Expected: [boolean,string], given: integer" ]
run helm template . --set ui.enabled=true
[ "$status" -eq 0 ]
}