mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-23 19:02:17 +00:00
fix(xcat-test): the cases restart a DHCPv4 unit that Ubuntu does not have
Ten cmd lines in five case files restarted the DHCPv4 server with the same inline probe of kea-dhcp4, falling back to isc-dhcp-server on Ubuntu. Kea is the backend there and its unit is kea-dhcp4-server, so the probe was false and the fallback named a unit that is not installed. The restart exited 5 with "Unit isc-dhcp-server.service not found" and failed the case. Each of those lines now calls commoncmd/restart_dhcp.sh. discovery_test also decided whether to create /var/lib/dhcpd/dhcpd.leases from the same single-unit probe, so on an Ubuntu management node it wrote an ISC leases file beside a Kea backend; it now asks restart_dhcp.sh --print-unit. Each rewritten line keeps the check that followed it. xcattest discards a cmd line that does not start with [#/$\w] and binds its checks to the previous command, so the calls are written as absolute paths. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -478,8 +478,8 @@ sub set_up_test_env_for_node_discovery {
|
||||
"rm -f /var/log/consoles/node-*",
|
||||
"rmdef $discovery_target_node",
|
||||
"rm -f /var/lib/dhcp/* /var/lib/kea/kea-leases4.csv 2>/dev/null; true",
|
||||
"if systemctl is-active kea-dhcp4 >/dev/null 2>&1; then true; else mkdir -p /var/lib/dhcpd; touch /var/lib/dhcpd/dhcpd.leases; fi",
|
||||
"if systemctl is-active kea-dhcp4 >/dev/null 2>&1; then systemctl restart kea-dhcp4; elif cat /etc/*release | grep -qi ubuntu; then service isc-dhcp-server restart; else service dhcpd restart; fi",
|
||||
"if /opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/restart_dhcp.sh --print-unit | grep -q '^kea'; then true; else mkdir -p /var/lib/dhcpd; touch /var/lib/dhcpd/dhcpd.leases; fi",
|
||||
"/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/restart_dhcp.sh",
|
||||
"$predef_node_cmd",
|
||||
"makehosts -a $discovery_prodefine_node_name_in_automation",
|
||||
"makedns $discovery_prodefine_node_name_in_automation");
|
||||
|
||||
@@ -34,7 +34,7 @@ cmd:makedhcp -n
|
||||
check:rc==0
|
||||
cmd:makedhcp -a
|
||||
check:rc==0
|
||||
cmd:if systemctl is-active kea-dhcp4 >/dev/null 2>&1; then systemctl restart kea-dhcp4; elif cat /etc/*release | grep -qi ubuntu; then service isc-dhcp-server restart; else service dhcpd restart; fi
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/restart_dhcp.sh
|
||||
check:rc==0
|
||||
cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done
|
||||
check:rc==0
|
||||
@@ -150,7 +150,7 @@ cmd:makedhcp -n
|
||||
check:rc==0
|
||||
cmd:makedhcp -a
|
||||
check:rc==0
|
||||
cmd:if systemctl is-active kea-dhcp4 >/dev/null 2>&1; then systemctl restart kea-dhcp4; elif cat /etc/*release | grep -qi ubuntu; then service isc-dhcp-server restart; else service dhcpd restart; fi
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/restart_dhcp.sh
|
||||
check:rc==0
|
||||
cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done
|
||||
check:rc==0
|
||||
|
||||
@@ -163,7 +163,7 @@ os:Linux
|
||||
label:cn_os_ready,dhcp
|
||||
cmd:makedhcp -a -d
|
||||
check:rc==0
|
||||
cmd:if systemctl is-active kea-dhcp4 >/dev/null 2>&1; then systemctl restart kea-dhcp4; elif cat /etc/*release | grep -qi ubuntu; then service isc-dhcp-server restart; else service dhcpd restart; fi
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/restart_dhcp.sh
|
||||
cmd:makedhcp -q $$CN
|
||||
check:rc==0
|
||||
check:output!~$$CN
|
||||
@@ -175,7 +175,7 @@ os:ubuntu
|
||||
label:cn_os_ready,dhcp
|
||||
cmd:makedhcp -a -d
|
||||
check:rc==0
|
||||
cmd:if systemctl is-active kea-dhcp4 >/dev/null 2>&1; then systemctl restart kea-dhcp4; elif cat /etc/*release | grep -qi ubuntu; then service isc-dhcp-server restart; else service dhcpd restart; fi
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/restart_dhcp.sh
|
||||
cmd:if [ -f /var/lib/kea/kea-leases4.csv ]; then cat /var/lib/kea/kea-leases4.csv | grep $$CN; elif [ -f /var/lib/dhcp/dhcpd.leases ]; then cat /var/lib/dhcp/dhcpd.leases | grep $$CN; fi
|
||||
check:output!~$$CN
|
||||
cmd:makedhcp -a
|
||||
@@ -186,7 +186,7 @@ os:Linux
|
||||
label:cn_os_ready,dhcp
|
||||
cmd:makedhcp -d $$CN
|
||||
check:rc==0
|
||||
cmd:if systemctl is-active kea-dhcp4 >/dev/null 2>&1; then systemctl restart kea-dhcp4; elif cat /etc/*release | grep -qi ubuntu; then service isc-dhcp-server restart; else service dhcpd restart; fi
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/restart_dhcp.sh
|
||||
cmd:makedhcp -q $$CN
|
||||
check:output!~$$CN
|
||||
cmd:makedhcp -a
|
||||
|
||||
@@ -24,7 +24,7 @@ cmd:makedhcp -n
|
||||
check:rc==0
|
||||
cmd:makedhcp -a
|
||||
check:rc==0
|
||||
cmd:if systemctl is-active kea-dhcp4 >/dev/null 2>&1; then systemctl restart kea-dhcp4; elif cat /etc/*release | grep -qi ubuntu; then service isc-dhcp-server restart; else service dhcpd restart; fi
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/restart_dhcp.sh
|
||||
check:rc==0
|
||||
cmd:if [ -f /etc/kea/kea-dhcp4.conf ]; then grep $$CN /etc/kea/kea-dhcp4.conf; elif cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat\|Rocky\|Alma" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi
|
||||
check:output=~$$CN
|
||||
@@ -133,7 +133,7 @@ cmd:makedhcp -n
|
||||
check:rc==0
|
||||
cmd:makedhcp -a
|
||||
check:rc==0
|
||||
cmd:if systemctl is-active kea-dhcp4 >/dev/null 2>&1; then systemctl restart kea-dhcp4; elif cat /etc/*release | grep -qi ubuntu; then service isc-dhcp-server restart; else service dhcpd restart; fi
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/restart_dhcp.sh
|
||||
check:rc==0
|
||||
cmd:if [ -f /etc/kea/kea-dhcp4.conf ]; then grep $$CN /etc/kea/kea-dhcp4.conf; elif cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat\|Rocky\|Alma" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi
|
||||
check:output=~$$CN
|
||||
|
||||
@@ -23,7 +23,7 @@ cmd:makedhcp -n
|
||||
check:rc==0
|
||||
cmd:makedhcp -a
|
||||
check:rc==0
|
||||
cmd:if systemctl is-active kea-dhcp4 >/dev/null 2>&1; then systemctl restart kea-dhcp4; elif cat /etc/*release | grep -qi ubuntu; then service isc-dhcp-server restart; else service dhcpd restart; fi
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/restart_dhcp.sh
|
||||
check:rc==0
|
||||
cmd:if [ -f /etc/kea/kea-dhcp4.conf ]; then grep $$CN /etc/kea/kea-dhcp4.conf; elif cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi
|
||||
check:output=~$$CN
|
||||
@@ -142,7 +142,7 @@ cmd:makedhcp -n
|
||||
check:rc==0
|
||||
cmd:makedhcp -a
|
||||
check:rc==0
|
||||
cmd:if systemctl is-active kea-dhcp4 >/dev/null 2>&1; then systemctl restart kea-dhcp4; elif cat /etc/*release | grep -qi ubuntu; then service isc-dhcp-server restart; else service dhcpd restart; fi
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/restart_dhcp.sh
|
||||
check:rc==0
|
||||
cmd:if [ -f /etc/kea/kea-dhcp4.conf ]; then grep $$CN /etc/kea/kea-dhcp4.conf; elif cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi
|
||||
check:output=~$$CN
|
||||
|
||||
Reference in New Issue
Block a user