Skip to content

Commit a6ef300

Browse files
committed
tests: remove sinful duplicate env strategy
This also had a side effect on subsequent tests, with the controller starting with _no_ LOG_VERBOSITY environment variable set. I don't understand that, but that must be a funky Helm-ism. Signed-off-by: Dr. Jan-Philip Gehrcke <[email protected]>
1 parent cac5cd9 commit a6ef300

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

tests/bats/cleanup-from-previous-run.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ kubectl get pods -n nvidia-dra-driver-gpu
3131
helm list -A
3232

3333
set -x
34+
35+
# If a previous run leaves e.g. the controller behind in CrashLoopBackOff then
36+
# the next installation with --wait won't succeed.
37+
timeout -v 5 helm uninstall nvidia-dra-driver-gpu-batssuite -n nvidia-dra-driver-gpu
38+
3439
# When the CRD has been left behind deleted by a partially performed
3540
# test then the deletions below cannot succeed. Apply a CRD version that
3641
# likely helps deletion.

tests/bats/tests.bats

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ log_objects() {
267267
}
268268

269269
@test "CD controller: test log verbosity levels" {
270+
iupgrade_wait "${TEST_CHART_REPO}" "${TEST_CHART_VERSION}" NOARGS
271+
270272
# Deploy workload: give the controller something to log about.
271273
log_objects
272274
kubectl apply -f demo/specs/imex/channel-injection.yaml
@@ -331,28 +333,14 @@ log_objects() {
331333
assert_output --partial 'round_trippers.go'
332334
assert_output --partial '"Response" verb="GET"'
333335

334-
# default log verbosity is 4; test if the controller-specific override to 6
335-
# works with the technique below -- this leads to a duplicate env name in the
336-
# pod spec -- allowed by the API server, and it's documented that the last
337-
# definition takes precedence.
338-
echo "test that component-specific env var takes precedence"
339-
local _iargs=(
340-
"--set" "controller.containers.computeDomain.env[0].name=LOG_VERBOSITY"
341-
"--set-string" "controller.containers.computeDomain.env[0].value=6"
342-
)
343-
iupgrade_wait "${TEST_CHART_REPO}" "${TEST_CHART_VERSION}" _iargs
344-
assert_output --partial '"Response" verb="GET"'
345-
346336
# Delete workload and hence CD daemon
347337
kubectl delete -f demo/specs/imex/channel-injection.yaml
348338
kubectl wait --for=delete pods imex-channel-injection --timeout=10s
349339
}
350340

351341
@test "CD daemon: test log verbosity levels" {
352342
log_objects
353-
354-
# Delete workload if it exists
355-
kubectl delete -f demo/specs/imex/channel-injection.yaml || true
343+
iupgrade_wait "${TEST_CHART_REPO}" "${TEST_CHART_VERSION}" NOARGS
356344

357345
echo "test level 6"
358346
local _iargs=("--set" "logVerbosity=6")
@@ -371,13 +359,13 @@ log_objects() {
371359
kubectl wait --for=delete pods imex-channel-injection --timeout=10s
372360

373361
echo "test level 0"
362+
log_objects
374363
# Reconfigure (only the) log verbosity for CD daemons spawned in the future.
375364
# The deployment mutation via `set env` below is expected to restart the
376365
# controller. Wait for the old controller pod to go away (to be sure that the
377366
# new LOG_VERBOSITY_CD_DAEMON setting applies), and make sure controller
378367
# deployment is still READY before moving on (make sure 1/1 READY).
379368
CPOD_OLD="$(get_current_controller_pod_name)"
380-
log_objects
381369
kubectl set env deployment nvidia-dra-driver-gpu-controller -n nvidia-dra-driver-gpu LOG_VERBOSITY_CD_DAEMON=0
382370
echo "wait --for=delete: $CPOD_OLD"
383371
kubectl wait --for=delete pods "$CPOD_OLD" -n nvidia-dra-driver-gpu --timeout=10s

0 commit comments

Comments
 (0)