e83cdd
From 15ff303dde65e97ba224a9f2cc6275cbaafee52c Mon Sep 17 00:00:00 2001
e83cdd
From: Lubomir Rintel <lkundrak@v3.sk>
e83cdd
Date: Mon, 10 Jun 2019 16:05:23 +0200
e83cdd
Subject: [PATCH] test/BONDBRIDGETEAMVLAN: don't assert against ifcfg files
e83cdd
e83cdd
The network-manager module writes keyfiles instead of ifcfg files. Just
e83cdd
check whether the configuration got actually applied correctly.
e83cdd
e83cdd
(cherry picked from commit 9dfd73bcbd899d8da4bc680fa8b3326c47b939bd)
e83cdd
---
e83cdd
 test/TEST-70-BONDBRIDGETEAMVLAN/client-init.sh |  6 +-----
e83cdd
 test/TEST-70-BONDBRIDGETEAMVLAN/test.sh        | 12 ++++++------
e83cdd
 2 files changed, 7 insertions(+), 11 deletions(-)
e83cdd
e83cdd
diff --git a/test/TEST-70-BONDBRIDGETEAMVLAN/client-init.sh b/test/TEST-70-BONDBRIDGETEAMVLAN/client-init.sh
e83cdd
index 8c33ff0f..083e0f59 100755
e83cdd
--- a/test/TEST-70-BONDBRIDGETEAMVLAN/client-init.sh
e83cdd
+++ b/test/TEST-70-BONDBRIDGETEAMVLAN/client-init.sh
e83cdd
@@ -10,11 +10,7 @@ echo "made it to the rootfs! Powering down."
e83cdd
 
e83cdd
 (
e83cdd
     echo OK
e83cdd
-    ip -o -4 address show scope global | while read n if rest; do echo $if;done | sort
e83cdd
-    for i in /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-*; do
e83cdd
-	echo $i
e83cdd
-	grep -v 'UUID=' $i
e83cdd
-    done
e83cdd
+    ip -o -4 address show scope global |sed -n 's/^[^:]*: \([^ ]*\) *\(.*\) scope.*/\1 \2/p' |sort
e83cdd
     echo EOF
e83cdd
 ) > /dev/sda
e83cdd
 
e83cdd
diff --git a/test/TEST-70-BONDBRIDGETEAMVLAN/test.sh b/test/TEST-70-BONDBRIDGETEAMVLAN/test.sh
e83cdd
index 5618baee..b6dd080c 100755
e83cdd
--- a/test/TEST-70-BONDBRIDGETEAMVLAN/test.sh
e83cdd
+++ b/test/TEST-70-BONDBRIDGETEAMVLAN/test.sh
e83cdd
@@ -112,8 +112,8 @@ client_test() {
e83cdd
         done
e83cdd
     } < "$TESTDIR"/client.img || return 1
e83cdd
 
e83cdd
-    if [[ "$check" != "$CONF" ]]; then
e83cdd
-        echo "Expected: '$check'"
e83cdd
+    if [[ ! "$CONF" =~ ^$check$ ]]; then
e83cdd
+        echo "Expected: /^$check\$/"
e83cdd
         echo
e83cdd
         echo
e83cdd
         echo "Got:      '$CONF'"
e83cdd
@@ -150,7 +150,7 @@ ip=192.168.57.104::192.168.57.1:24:test:ens5.0004:none
e83cdd
 rd.neednet=1
e83cdd
 root=nfs:192.168.50.1:/nfs/client bootdev=ens3
e83cdd
 " \
e83cdd
-    '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 ' \
e83cdd
+    '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 ' \
e83cdd
     || return 1
e83cdd
 
e83cdd
     client_test "Multiple Bonds" \
e83cdd
@@ -163,7 +163,7 @@ ip=bond1:dhcp
e83cdd
 rd.neednet=1
e83cdd
 root=nfs:192.168.50.1:/nfs/client bootdev=bond0
e83cdd
 " \
e83cdd
-    '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 ' \
e83cdd
+    '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 ' \
e83cdd
     || return 1
e83cdd
 
e83cdd
     client_test "Multiple Bridges" \
e83cdd
@@ -176,7 +176,7 @@ ip=br1:dhcp
e83cdd
 rd.neednet=1
e83cdd
 root=nfs:192.168.50.1:/nfs/client bootdev=br0
e83cdd
 " \
e83cdd
-    '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 ' \
e83cdd
+    '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 ' \
e83cdd
     || return 1
e83cdd
 
e83cdd
     kill_server
e83cdd
@@ -260,7 +260,7 @@ test_setup() {
e83cdd
         export initdir="$TESTDIR"/mnt/nfs/client
e83cdd
         . "$basedir"/dracut-init.sh
e83cdd
         inst_multiple sh shutdown poweroff stty cat ps ln ip \
e83cdd
-            mount dmesg mkdir cp ping grep ls sort
e83cdd
+            mount dmesg mkdir cp ping grep ls sort sed
e83cdd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
e83cdd
             [[ -f ${_terminfodir}/l/linux ]] && break
e83cdd
         done
e83cdd