#!/bin/bash## kola:## # appendKernelArgs is only supported on QEMU## platforms: qemu## appendKernelArgs: "nameserver=8.8.8.8 nameserver=1.1.1.1"## description: Verify that we config multiple nameservers via kernel## arguments work well.# RHCOS: need to check /etc/resolv.conf and nmconnection.# FCOS: using systemd-resolved which needs to run resolvectl to check.# See https://bugzilla.redhat.com/show_bug.cgi?id=1763341set -xeuo pipefail# shellcheck disable=SC1091. "$KOLA_EXT_DATA/commonlib.sh"if is_fcos; then# run resolvectldns=$(resolvectl dns)if ! ([[ "$dns" =~ "8.8.8.8" ]] && [[ "$dns" =~ "1.1.1.1" ]]); thenfatal "Error: can not find nameserver via resolvectl"fielif is_rhcos; then# check nameserver in /etc/resolv.confresolv=/etc/resolv.confcat ${resolv}if ! (grep -q "nameserver 8.8.8.8" ${resolv} && \grep -q "nameserver 1.1.1.1" ${resolv}); thenfatal "Error: can not find nameserver in ${resolv}"fifi# check nameserver in config fileconf=/etc/NetworkManager/system-connections/default_connection.nmconnectioncat ${conf}if ! grep -q "dns=8.8.8.8;1.1.1.1;" ${conf}; thenfatal "Error: can not find nameserver in ${conf}"fiok "multiple nameserver"