Skip to content

Commit

Permalink
Improved add-del.t command line test
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs committed Jul 31, 2015
1 parent 9339a5b commit 6a1c30d
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions t/add-del.t
Expand Up @@ -5,20 +5,20 @@
set -eu

# test plan
echo 1..8
echo 1..7

# usage:
# foo || tapfail
# echo "ok"
# this will tell TAP "not ok" IFF foo has failed
# this will tell TAP "not ok" IF foo has failed
tapfail() {
echo -n "not "
}

YAST=/usr/sbin/yast

echo "# assume and check that eth0 exists, as a base for the vlan"
ip addr show dev eth0 || tapfail
ip addr show dev eth0
echo "ok 1 eth0: exists already"

echo "# add a (virtual) interface"
Expand All @@ -32,18 +32,15 @@ echo "ok 3 vlan50: interface exists"
ls /etc/sysconfig/network/ifcfg-vlan50 || tapfail
echo "ok 4 vlan50: ifcfg exists"

echo "# find it"
echo "# find it and delete it"
# the embarassing part: no way to identify by "vlan50"
ID=$($YAST lan list |& grep Virtual.LAN | cut -f1)
echo "ok 5 vlan50: yast specific ID found"

echo "# delete it"
$YAST lan delete id=$ID verbose
echo "ok 6 vlan50: deleted"
$YAST lan delete id=$ID verbose || tapfail
echo "ok 5 vlan50: deleted"

# how to assert nonexistence?
! ip addr show dev vlan50 || tapfail
echo "ok 7 vlan50: interface does not exist"
echo "ok 6 vlan50: interface does not exist"

! ls /etc/sysconfig/network/ifcfg-vlan50 || tapfail
echo "ok 8 vlan50: ifcfg does not exist"
echo "ok 7 vlan50: ifcfg does not exist"

0 comments on commit 6a1c30d

Please sign in to comment.