@@ -337,6 +337,48 @@ log_objects() {
337337 iupgrade_wait " ${TEST_CHART_REPO} " " ${TEST_CHART_VERSION} " _iargs
338338 assert_output --partial ' "Response" verb="GET"'
339339
340+ # Delete workload and hence CD daemon
341+ kubectl delete -f demo/specs/imex/channel-injection.yaml
342+ kubectl wait --for=delete pods imex-channel-injection --timeout=10s
343+ }
344+
345+ @test " CD daemon: test log verbosity levels" {
346+ log_objects
347+
348+ # Delete workload if it exists
349+ kubectl delete -f demo/specs/imex/channel-injection.yaml || true
350+
351+ echo " test level 6"
352+ local _iargs=(" --set" " logVerbosity=6" )
353+ iupgrade_wait " ${TEST_CHART_REPO} " " ${TEST_CHART_VERSION} " _iargs
354+
355+ kubectl apply -f demo/specs/imex/channel-injection.yaml
356+ kubectl wait --for=condition=READY pods imex-channel-injection --timeout=100s
357+
358+ # Confirm that the CD daemon logs on level six
359+ run get_all_cd_daemon_logs_for_cd_name " imex-channel-injection"
360+ assert_output --partial ' wait for nodes update' # level 1 msg
361+ assert_output --partial ' round_trippers.go' # level 6 msg
362+
363+ # Delete workload and hence CD daemon
364+ kubectl delete -f demo/specs/imex/channel-injection.yaml
365+ kubectl wait --for=delete pods imex-channel-injection --timeout=10s
366+
367+ echo " test level 0"
368+ # Reconfigure log verbosity for CD daemons spawned in the future.
369+ # This deployment mutation is expected to restart the controller.
370+ kubectl set env deployment nvidia-dra-driver-gpu-controller -n nvidia-dra-driver-gpu LOG_VERBOSITY_CD_DAEMON=0
371+
372+ sleep 5
373+ # Spawn new workload
374+ kubectl apply -f demo/specs/imex/channel-injection.yaml
375+ kubectl wait --for=condition=READY pods imex-channel-injection --timeout=100s
376+
377+ # Confirm that the CD daemon now does not contain a level 1 msg
378+ run get_all_cd_daemon_logs_for_cd_name " imex-channel-injection"
379+ refute_output --partial ' wait for nodes update' # expected level 1 msg
380+
381+ # Delete workload
340382 kubectl delete -f demo/specs/imex/channel-injection.yaml
341383 kubectl wait --for=delete pods imex-channel-injection --timeout=10s
342384}
0 commit comments