test/unit: client DaemonSet

This commit is contained in:
Mitchell Hashimoto 2018-09-03 09:08:57 -07:00
parent 64f43108f7
commit 5e1e1b1bf6
No known key found for this signature in database
GPG key ID: 744E147AA52F5B0A
3 changed files with 54 additions and 2 deletions

View file

@ -1,5 +1,5 @@
# DaemonSet to run the Consul clients on every node. # DaemonSet to run the Consul clients on every node.
{{- if (default .Values.client.enabled .Values.global.enabled) }} {{- if (or (and (ne (.Values.client.enabled | toString) "-") .Values.client.enabled) (and (eq (.Values.client.enabled | toString) "-") .Values.global.enabled)) }}
apiVersion: apps/v1 apiVersion: apps/v1
kind: DaemonSet kind: DaemonSet
metadata: metadata:

52
test/unit/client-daemonset.yaml Executable file
View file

@ -0,0 +1,52 @@
#!/usr/bin/env bats
load _helpers
@test "client/DaemonSet: enabled by default" {
cd `chart_dir`
local actual=$(helm template \
-x templates/client-daemonset.yaml \
. | tee /dev/stderr |
yq 'length > 0' | tee /dev/stderr)
[ "${actual}" = "true" ]
}
@test "client/DaemonSet: enable with global.enabled false" {
cd `chart_dir`
local actual=$(helm template \
-x templates/client-daemonset.yaml \
--set 'global.enabled=false' \
--set 'client.enabled=true' \
. | tee /dev/stderr |
yq 'length > 0' | tee /dev/stderr)
[ "${actual}" = "true" ]
}
@test "client/DaemonSet: disable with client.enabled" {
cd `chart_dir`
local actual=$(helm template \
-x templates/client-daemonset.yaml \
--set 'client.enabled=false' \
. | tee /dev/stderr |
yq 'length > 0' | tee /dev/stderr)
[ "${actual}" = "false" ]
}
@test "client/DaemonSet: disable with global.enabled" {
cd `chart_dir`
local actual=$(helm template \
-x templates/client-daemonset.yaml \
--set 'global.enabled=false' \
. | tee /dev/stderr |
yq 'length > 0' | tee /dev/stderr)
[ "${actual}" = "false" ]
}
@test "client/DaemonSet: no updateStrategy when not updating" {
cd `chart_dir`
local actual=$(helm template \
-x templates/client-daemonset.yaml \
. | tee /dev/stderr |
yq -r '.spec.updateStrategy' | tee /dev/stderr)
[ "${actual}" = "null" ]
}

View file

@ -60,7 +60,7 @@ server:
# within the Kube cluster. The current deployment model follows a traditional # within the Kube cluster. The current deployment model follows a traditional
# DC where a single agent is deployed per node. # DC where a single agent is deployed per node.
client: client:
enabled: null enabled: "-"
image: "consul:1.2.2" image: "consul:1.2.2"
join: null join: null