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