Skip to content

Commit

Permalink
include tests to validate that qps and burst are being set when provi…
Browse files Browse the repository at this point in the history
…ded and not set by default
  • Loading branch information
jaireddjawed committed Feb 12, 2025
1 parent 9093d4f commit 783a3fc
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions test/unit/deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1292,3 +1292,61 @@ load _helpers
[ "$(echo "${job}" | \
yq '(.spec.template.spec.containers[0].imagePullPolicy == "IfNotPresent")')" = "true" ]
}


#--------------------------------------------------------------------
# kubeClient

@test "controller/Deployment: kubeClient qps not set by default" {
cd `chart_dir`
local object
object=$(helm template \
-s templates/deployment.yaml \
. | tee /dev/stderr |
yq 'select(.kind == "Deployment" and .metadata.labels."control-plane" == "controller-manager") | .spec.template.spec.containers[] | select(.name == "manager") | .args' | tee /dev/stderr)

local actual
actual=$(echo "$object" | yq 'contains(["--kube-client-qps"])' | tee /dev/stderr)
[ "${actual}" = "false" ]
}

@test "controller/Deployment: kubeClient qps can be set" {
cd `chart_dir`
local object
object=$(helm template \
-s templates/deployment.yaml \
--set 'controller.manager.kubeClient.qps=200' \
. | tee /dev/stderr |
yq 'select(.kind == "Deployment" and .metadata.labels."control-plane" == "controller-manager") | .spec.template.spec.containers[] | select(.name == "manager") | .args' | tee /dev/stderr)

local actual
actual=$(echo "$object" | yq 'contains(["--kube-client-qps=200"])' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

@test "controller/Deployment: kubeClient burst not set by default" {
cd `chart_dir`
local object
object=$(helm template \
-s templates/deployment.yaml \
. | tee /dev/stderr |
yq 'select(.kind == "Deployment" and .metadata.labels."control-plane" == "controller-manager") | .spec.template.spec.containers[] | select(.name == "manager") | .args' | tee /dev/stderr)

local actual
actual=$(echo "$object" | yq 'contains(["--kube-client-burst"])' | tee /dev/stderr)
[ "${actual}" = "false" ]
}

@test "controller/Deployment: kubeClient burst can be set" {
cd `chart_dir`
local object
object=$(helm template \
-s templates/deployment.yaml \
--set 'controller.manager.kubeClient.burst=2000' \
. | tee /dev/stderr |
yq 'select(.kind == "Deployment" and .metadata.labels."control-plane" == "controller-manager") | .spec.template.spec.containers[] | select(.name == "manager") | .args' | tee /dev/stderr)

local actual
actual=$(echo "$object" | yq 'contains(["--kube-client-burst=2000"])' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

0 comments on commit 783a3fc

Please sign in to comment.