Skip to content

Commit

Permalink
Added unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
mchf authored and mvidner committed Jul 18, 2012
1 parent 3d4cc6a commit b900261
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
1 change: 1 addition & 0 deletions package/yast2-network.changes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Mon Jul 2 09:23:14 UTC 2012 - mfilka@suse.com

- fate#312287 - hotpluging of bonding slaves
- updated UI - added columns into net device overview
- updated testsuite
- 2.24.0

-------------------------------------------------------------------
Expand Down
Empty file added testsuite/tests/bond.err
Empty file.
18 changes: 18 additions & 0 deletions testsuite/tests/bond.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Dump NetworkInterfaces::Read
Dir .network.section: ["bond0", "eth1", "eth2", "eth4", "eth5"]
Dir .network.value."bond0": ["BONDING_MASTER", "BONDING_SLAVE0", "BONDING_SLAVE1", "BOOTPROTO"]
Read .network.value."bond0".BONDING_MASTER "yes"
Read .network.value."bond0".BONDING_SLAVE0 "eth1"
Read .network.value."bond0".BONDING_SLAVE1 "eth2"
Read .network.value."bond0".BOOTPROTO "static"
Dir .network.value."eth1": ["BOOTPROTO"]
Read .network.value."eth1".BOOTPROTO "none"
Dir .network.value."eth2": ["BOOTPROTO"]
Read .network.value."eth2".BOOTPROTO "none"
Dir .network.value."eth4": ["BOOTPROTO"]
Read .network.value."eth4".BOOTPROTO "none"
Dir .network.value."eth5": ["BOOTPROTO"]
Read .network.value."eth5".BOOTPROTO "none"
Return true
Dump LanItems::BuildBondIndex
Dump LanItems::GetBondSlaves
57 changes: 57 additions & 0 deletions testsuite/tests/bond.ycp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
import "LanItems";
import "NetworkInterfaces";
import "Assert";
import "Testsuite";

map READ = $[
"network" : $[
"section" : $[
"eth1" : nil,
"eth2" : nil,

"eth4" : nil,
"eth5" : nil,

"bond0" : nil,
],
"value" : $[
"eth1" : $["BOOTPROTO":"none"],
"eth2" : $["BOOTPROTO":"none"],

"eth4" : $["BOOTPROTO":"none"],
"eth5" : $["BOOTPROTO":"none"],

"bond0" : $[
"BOOTPROTO":"static",
"BONDING_MASTER":"yes",
"BONDING_SLAVE0":"eth1",
"BONDING_SLAVE1":"eth2",
],
]
],
"probe" : $[
"system" : [],
],
"target" : $[
"tmpdir" : "/tmp",
],
];

Testsuite::Init([READ], 0);

Testsuite::Dump( "NetworkInterfaces::Read");
Testsuite::Test(``(NetworkInterfaces::Read()), [READ], nil);

Testsuite::Dump("LanItems::BuildBondIndex");
map expected_bond_index = $[
"eth1": "bond0",
"eth2": "bond0",
];
Assert::Equal( expected_bond_index, LanItems::BuildBondIndex());

Testsuite::Dump("LanItems::GetBondSlaves");
list expected_bond_slaves = [ "eth1", "eth2" ];
Assert::Equal( expected_bond_slaves, LanItems::GetBondSlaves( "bond0"));

} /* EOF */

0 comments on commit b900261

Please sign in to comment.