
* Refactor chart for 1.0, add tests, update TF * Fix typo in helper comment * Add NOTES for post install instructions * Fix typo in NOTES * Fix replication port for enterprise * Change updateStrategy to OnDelete * Add icon * Remove cluster address from config * Update README, add contributing doc * Update README * Change HA replicas to 3
165 lines
5.3 KiB
Bash
Executable file
165 lines
5.3 KiB
Bash
Executable file
#!/usr/bin/env bats
|
|
|
|
load _helpers
|
|
|
|
@test "server/Service: service enabled by default" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.dev.enabled=true' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "true" ]
|
|
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.ha.enabled=true' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "true" ]
|
|
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.standalone.enabled=true' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "true" ]
|
|
}
|
|
|
|
|
|
@test "server/Service: disable with global.enabled false" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.dev.enabled=true' \
|
|
--set 'global.enabled=false' \
|
|
--set 'server.service.enabled=true' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.ha.enabled=true' \
|
|
--set 'global.enabled=false' \
|
|
--set 'server.service.enabled=true' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.standalone.enabled=true' \
|
|
--set 'global.enabled=false' \
|
|
--set 'server.service.enabled=true' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
}
|
|
|
|
@test "server/Service: disable with server.service.enabled false" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.dev.enabled=true' \
|
|
--set 'server.service.enabled=false' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.ha.enabled=true' \
|
|
--set 'server.service.enabled=false' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.standalone.enabled=true' \
|
|
--set 'server.service.enabled=false' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
}
|
|
|
|
@test "server/Service: disable with global.enabled false server.service.enabled false" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.dev.enabled=true' \
|
|
--set 'global.enabled=false' \
|
|
--set 'server.service.enabled=false' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.ha.enabled=true' \
|
|
--set 'global.enabled=false' \
|
|
--set 'server.service.enabled=false' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.standalone.enabled=true' \
|
|
--set 'global.enabled=false' \
|
|
--set 'server.service.enabled=false' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
}
|
|
|
|
# This can be seen as testing just what we put into the YAML raw, but
|
|
# this is such an important part of making everything work we verify it here.
|
|
@test "server/Service: tolerates unready endpoints" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.dev.enabled=true' \
|
|
. | tee /dev/stderr |
|
|
yq -r '.metadata.annotations["service.alpha.kubernetes.io/tolerate-unready-endpoints"]' | tee /dev/stderr)
|
|
[ "${actual}" = "true" ]
|
|
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.ha.enabled=true' \
|
|
. | tee /dev/stderr |
|
|
yq -r '.metadata.annotations["service.alpha.kubernetes.io/tolerate-unready-endpoints"]' | tee /dev/stderr)
|
|
[ "${actual}" = "true" ]
|
|
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.standalone.enabled=true' \
|
|
. | tee /dev/stderr |
|
|
yq -r '.metadata.annotations["service.alpha.kubernetes.io/tolerate-unready-endpoints"]' | tee /dev/stderr)
|
|
[ "${actual}" = "true" ]
|
|
}
|
|
|
|
@test "server/Service: publish not ready" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.dev.enabled=true' \
|
|
. | tee /dev/stderr |
|
|
yq -r '.spec.publishNotReadyAddresses' | tee /dev/stderr)
|
|
[ "${actual}" = "true" ]
|
|
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.ha.enabled=true' \
|
|
. | tee /dev/stderr |
|
|
yq -r '.spec.publishNotReadyAddresses' | tee /dev/stderr)
|
|
[ "${actual}" = "true" ]
|
|
|
|
local actual=$(helm template \
|
|
-x templates/server-service.yaml \
|
|
--set 'server.standalone.enabled=true' \
|
|
. | tee /dev/stderr |
|
|
yq -r '.spec.publishNotReadyAddresses' | tee /dev/stderr)
|
|
[ "${actual}" = "true" ]
|
|
}
|