2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-22 11:10:24 +00:00

Merge pull request #5898 from tingtli/task88

Add test case for issue 3571, 4085 and 3927  for makenetworks,chdef and mkdef for networks.
This commit is contained in:
Yuan Bai
2018-12-27 10:40:58 +08:00
committed by GitHub
3 changed files with 98 additions and 2 deletions

View File

@@ -273,3 +273,46 @@ check:output=~300
cmd:if [ -f /tmp/sitevalue ];then var=`cat /tmp/sitevalue`;chdef -t site clustersite dhcplease=$var;rm -rf /tmp/sitevalue;fi
check:rc==0
end
start:chdef_network_not_exist
description:This case is use to create a network, but not set net and mask.
label:mn_only,db
cmd:chdef -t network aaaaa_not_exist
check:output=~No object definitions have been created or modified
#check:rc!=0
cmd:chdef -t network aaaaa_not_exist mtu=1500
check:rc!=0
check:output=~Net or mask value should not be empty
cmd:chdef -t network aaaaa_not_exist mtu=1500 net=10.0.0.0
check:rc!=0
check:output=~Net or mask value should not be empty
cmd:chdef -t network aaaaa_not_exist mtu=1500 mask=255.255.255.0
check:rc!=0
check:output=~Net or mask value should not be empty
cmd:chdef -t network aaaaa_not_exist mask=255.255.255.0 net=100.0.0.0 mtu=1500
check:rc==0
check:output=~1 object definitions have been created or modified
cmd:lsdef -t network aaaaa_not_exist
check:rc==0
cmd:chdef -t network aaaaa_not_exist gateway=10.0.0.101
check:rc==0
cmd:lsdef -t network aaaaa_not_exist -i gateway
check:output=~10.0.0.101
cmd:chdef -t network bbbbb_not_exist mask=255.255.255.0 net=100.0.0.0
check:rc!=0
check:output=~A network definition called 'aaaaa_not_exist' already exists
cmd:echo '
bbbbb_not_exist:
objtype=network
net=150.0.0.0
' > /tmp/bbbbb_not_exist.def
cmd:cat /tmp/bbbbb_not_exist.def |mkdef -z
check:rc!=0
check:output=~Net or mask value should not be empty
cmd:lsdef -t network -o bbbbb_not_exist
check:rc!=0
cmd:rmdef -t network -o aaaaa_not_exist
check:rc==0
cmd:rm -rf /tmp/bbbbb_not_exist.def
end

View File

@@ -70,5 +70,11 @@ cmd:rm -f /tmp/testnetworks
cmd:rm -f /tmp/inetworktest1
end
start:makenetworks_netname_exist
os:Linux
description:test makenetworks works as design when netname exists.
label:others,network
cmd:netname=`lsdef -t network |cut -d" " -f1 |sed -n '1p'`;makenetworks $netname
check:rc==0
check:output=~(already exists)
end

View File

@@ -159,6 +159,53 @@ check:output=~gateway=1.2.3.1
cmd:rmdef -t network testnetwork
end
start:mkdef_netname_exist
os:Linux
description:test mkdef works as design when netname exists.
label:mn_only,ci_test,db
cmd:netname=`lsdef -t network |cut -d" " -f1 |sed -n '1p'`;mkdef -t network -o $netname
check:rc==0
check:output=~(already exists)
end
start:mkdef_netname_notexist_without_net_mask
os:Linux
description:test mkdef works as design when net and mask is not defined.
label:mn_only,ci_test,db
cmd:mkdef -t network -o testnetworkwithoutnetandmask
check:rc!=0
check:output=~Error
cmd:mkdef -t network -o testnetworkwithoutnetandmask mtu=1500
check:rc!=0
check:output=~Net or mask value should not be empty
cmd:mkdef -t network -o testnetworkwithoutnetandmask net=10.0.0.0 mtu=1500
check:rc!=0
check:output=~Net or mask value should not be empty
cmd:mkdef -t network -o testnetworkwithoutnetandmask mask=255.0.0.0 mtu=1500
check:rc!=0
check:output=~Net or mask value should not be empty
cmd:mkdef -t network -o testnetworkwithoutnetandmask net=100.0.0.1 mask=255.0.0.0 mtu=1500
check:rc==0
check:output=~1 object definitions have been created or modified
cmd:lsdef -t network -z testnetworkwithoutnetandmask |tee /tmp/testnetworkwithoutnetandmask.stanza
check:rc==0
cmd:cat /tmp/testnetworkwithoutnetandmask.stanza|mkdef -z
check:rc!=0
check:output=~(already exists)
cmd:rmdef -t network testnetworkwithoutnetandmask
check:rc==0
end
start:mkdef_networks_if_net_mask_exists
os:Linux
description:test makenetworks works as design when net and mask exists. The network could not be created since net and mask are
the same.
label:mn_only,ci_test,db
cmd:netname=`lsdef -t network |cut -d" " -f1 |sed -n '1p'`;net=`lsdef -t network -o $netname |grep -i net |awk -F = '{print $2}'`;mask=`lsdef -t network -o $netname |grep -i mask |awk -F = '{print $2}'`;mkdef -t network -o testnetworkwithnetandmask net=$net mask=$mask
check:rc!=0
check:output=~(already exists)
end
start:mkdef_t_o_error
description:mkdef -t wrongtype
label:mn_only,ci_test,db