Skip to content

Commit

Permalink
added bats testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
rigalGit committed Aug 29, 2023
1 parent 1318f3a commit d4ab6b5
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions charts/consul/test/unit/server-statefulset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,41 @@ load _helpers
[ "${actual}" = "/v1/agent/metrics" ]
}

@test "server/StatefulSet: when global.metrics.enableAgentMetrics=true, adds prometheus scheme=http annotation" {
cd `chart_dir`
local actual=$(helm template \
-s templates/server-statefulset.yaml \
--set 'global.metrics.enabled=true' \
--set 'global.metrics.enableAgentMetrics=true' \
. | tee /dev/stderr |
yq -r '.spec.template.metadata.annotations."prometheus.io/scheme"' | tee /dev/stderr)
[ "${actual}" = "http" ]
}

@test "server/StatefulSet: when global.metrics.enableAgentMetrics=true and global.tls.enabled=true, adds prometheus port=8501 annotation" {
cd `chart_dir`
local actual=$(helm template \
-s templates/server-statefulset.yaml \
--set 'global.metrics.enabled=true' \
--set 'global.metrics.enableAgentMetrics=true' \
--set 'global.tls.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.metadata.annotations."prometheus.io/port"' | tee /dev/stderr)
[ "${actual}" = "8501" ]
}

@test "server/StatefulSet: when global.metrics.enableAgentMetrics=true and global.tls.enabled=true, adds prometheus scheme=https annotation" {
cd `chart_dir`
local actual=$(helm template \
-s templates/server-statefulset.yaml \
--set 'global.metrics.enabled=true' \
--set 'global.metrics.enableAgentMetrics=true' \
--set 'global.tls.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.metadata.annotations."prometheus.io/scheme"' | tee /dev/stderr)
[ "${actual}" = "https" ]
}

#--------------------------------------------------------------------
# config-configmap

Expand Down

0 comments on commit d4ab6b5

Please sign in to comment.