#!/bin/bash## kola:## # appendFirstbootKernelArgs is only supported on QEMU## platforms: qemu## # The functionality we're testing here.## appendFirstbootKernelArgs: "rd.net.timeout.dhcp=30 rd.net.dhcp.retry=8"## description: Verify rd.net.timeout.dhcp and rd.net.dhcp.retry## are supported by NetworkManager.# See# - https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/559# - https://bugzilla.redhat.com/show_bug.cgi?id=1879094#c10# - https://bugzilla.redhat.com/show_bug.cgi?id=1877740# Append "rd.net.timeout.dhcp=30 rd.net.dhcp.retry=8" to kernel parameter# when boot, get total timeout is `timeout * retry`, 30*8(240) seconds# in this test scenario.set -xeuo pipefail# shellcheck disable=SC1091. "$KOLA_EXT_DATA/commonlib.sh"# check kernel parametercmdline="/proc/cmdline"for rd in rd.net.timeout.dhcp rd.net.dhcp.retry;doif ! grep -q $rd $cmdline; thenfatal "Error: can not find $rd in kernel parameter"fidonelog=$(journalctl -b -u NetworkManager | grep "beginning transaction")timeout=$(echo $log | awk -F'[( )]' '{print $(NF-2)}')if [ $timeout -ne 240 ]; thenfatal "Error: actual dhcp timeout is $timeout, expected 240"fiok "Total dhcp timeout matches expected value"