From 15ff303dde65e97ba224a9f2cc6275cbaafee52c Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 10 Jun 2019 16:05:23 +0200 Subject: [PATCH] test/BONDBRIDGETEAMVLAN: don't assert against ifcfg files The network-manager module writes keyfiles instead of ifcfg files. Just check whether the configuration got actually applied correctly. (cherry picked from commit 9dfd73bcbd899d8da4bc680fa8b3326c47b939bd) --- test/TEST-70-BONDBRIDGETEAMVLAN/client-init.sh | 6 +----- test/TEST-70-BONDBRIDGETEAMVLAN/test.sh | 12 ++++++------ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/test/TEST-70-BONDBRIDGETEAMVLAN/client-init.sh b/test/TEST-70-BONDBRIDGETEAMVLAN/client-init.sh index 8c33ff0f..083e0f59 100755 --- a/test/TEST-70-BONDBRIDGETEAMVLAN/client-init.sh +++ b/test/TEST-70-BONDBRIDGETEAMVLAN/client-init.sh @@ -10,11 +10,7 @@ echo "made it to the rootfs! Powering down." ( echo OK - ip -o -4 address show scope global | while read n if rest; do echo $if;done | sort - for i in /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-*; do - echo $i - grep -v 'UUID=' $i - done + ip -o -4 address show scope global |sed -n 's/^[^:]*: \([^ ]*\) *\(.*\) scope.*/\1 \2/p' |sort echo EOF ) > /dev/sda diff --git a/test/TEST-70-BONDBRIDGETEAMVLAN/test.sh b/test/TEST-70-BONDBRIDGETEAMVLAN/test.sh index 5618baee..b6dd080c 100755 --- a/test/TEST-70-BONDBRIDGETEAMVLAN/test.sh +++ b/test/TEST-70-BONDBRIDGETEAMVLAN/test.sh @@ -112,8 +112,8 @@ client_test() { done } < "$TESTDIR"/client.img || return 1 - if [[ "$check" != "$CONF" ]]; then - echo "Expected: '$check'" + if [[ ! "$CONF" =~ ^$check$ ]]; then + echo "Expected: /^$check\$/" echo echo echo "Got: '$CONF'" @@ -150,7 +150,7 @@ ip=192.168.57.104::192.168.57.1:24:test:ens5.0004:none rd.neednet=1 root=nfs:192.168.50.1:/nfs/client bootdev=ens3 " \ - 'ens3 ens5.0004 ens5.3 vlan0001 vlan2 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens3 # Generated by dracut initrd NAME="ens3" DEVICE="ens3" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp TYPE=Ethernet /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens5.0004 # Generated by dracut initrd NAME="ens5.0004" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.57.104" PREFIX="24" GATEWAY="192.168.57.1" TYPE=Vlan DEVICE="ens5.0004" VLAN=yes PHYSDEV="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens5.3 # Generated by dracut initrd NAME="ens5.3" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.56.103" PREFIX="24" GATEWAY="192.168.56.1" TYPE=Vlan DEVICE="ens5.3" VLAN=yes PHYSDEV="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-vlan0001 # Generated by dracut initrd NAME="vlan0001" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.54.101" PREFIX="24" GATEWAY="192.168.54.1" TYPE=Vlan DEVICE="vlan0001" VLAN=yes PHYSDEV="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-vlan2 # Generated by dracut initrd NAME="vlan2" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.55.102" PREFIX="24" GATEWAY="192.168.55.1" TYPE=Vlan DEVICE="vlan2" VLAN=yes PHYSDEV="ens5" EOF ' \ + 'ens3 inet 192\.168\.50\.[0-9]*/24 brd 192\.168\.50\.255 ens5\.0004 inet 192\.168\.57\.104/24 brd 192\.168\.57\.255 ens5\.3 inet 192\.168\.56\.103/24 brd 192\.168\.56\.255 vlan0001 inet 192\.168\.54\.101/24 brd 192\.168\.54\.255 vlan2 inet 192\.168\.55\.102/24 brd 192\.168\.55\.255 EOF ' \ || return 1 client_test "Multiple Bonds" \ @@ -163,7 +163,7 @@ ip=bond1:dhcp rd.neednet=1 root=nfs:192.168.50.1:/nfs/client bootdev=bond0 " \ - 'bond0 bond1 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-bond0 # Generated by dracut initrd NAME="bond0" DEVICE="bond0" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp BONDING_OPTS="" NAME="bond0" TYPE=Bond /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-bond1 # Generated by dracut initrd NAME="bond1" DEVICE="bond1" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp BONDING_OPTS="" NAME="bond1" TYPE=Bond /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens4 # Generated by dracut initrd NAME="ens4" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond0" DEVICE="ens4" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens5 # Generated by dracut initrd NAME="ens5" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond0" DEVICE="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens6 # Generated by dracut initrd NAME="ens6" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond1" DEVICE="ens6" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens7 # Generated by dracut initrd NAME="ens7" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond1" DEVICE="ens7" EOF ' \ + 'bond0 inet 192\.168\.50\.[0-9]*/24 brd 192\.168\.50\.255 bond1 inet 192\.168\.51\.[0-9]*/24 brd 192\.168\.51\.255 EOF ' \ || return 1 client_test "Multiple Bridges" \ @@ -176,7 +176,7 @@ ip=br1:dhcp rd.neednet=1 root=nfs:192.168.50.1:/nfs/client bootdev=br0 " \ - 'br0 br1 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-br0 # Generated by dracut initrd NAME="br0" DEVICE="br0" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp TYPE=Bridge NAME="br0" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-br1 # Generated by dracut initrd NAME="br1" DEVICE="br1" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp TYPE=Bridge NAME="br1" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens4 # Generated by dracut initrd NAME="ens4" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br0" DEVICE="ens4" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens5 # Generated by dracut initrd NAME="ens5" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br0" DEVICE="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens6 # Generated by dracut initrd NAME="ens6" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br1" DEVICE="ens6" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens7 # Generated by dracut initrd NAME="ens7" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br1" DEVICE="ens7" EOF ' \ + 'br0 inet 192\.168\.50\.[0-9]*/24 brd 192\.168\.50\.255 br1 inet 192\.168\.51\.[0-9]*/24 brd 192\.168\.51\.255 EOF ' \ || return 1 kill_server @@ -260,7 +260,7 @@ test_setup() { export initdir="$TESTDIR"/mnt/nfs/client . "$basedir"/dracut-init.sh inst_multiple sh shutdown poweroff stty cat ps ln ip \ - mount dmesg mkdir cp ping grep ls sort + mount dmesg mkdir cp ping grep ls sort sed for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do [[ -f ${_terminfodir}/l/linux ]] && break done