Add unit tests for hroller
authorKlaus Aehlig <aehlig@google.com>
Mon, 22 Apr 2013 11:09:06 +0000 (13:09 +0200)
committerKlaus Aehlig <aehlig@google.com>
Mon, 22 Apr 2013 16:43:29 +0000 (18:43 +0200)
Add a unit test for hroller in a situation where the order
is completely determined. There are 3 nodes where node 2 has,
for each of the other nodes, an instanced shared with it. So
node 2 has to be a reboot group of its own. There are no more
instances, hence, my minimality, the other two nodes have to
form a single group. Node 1 is the master, and hence has to
be rebooted last; this determines the order.

Also add a unit test verifying that hroller rejects configurations
with multiple master nodes, even if the option --force is given.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

Makefile.am
test/data/htools/multiple-master.data [copied from test/data/htools/empty-cluster.data with 61% similarity]
test/data/htools/unique-reboot-order.data [copied from test/data/htools/clean-nonzero-score.data with 55% similarity]
test/hs/shelltests/htools-hroller.test [new file with mode: 0644]
test/hs/shelltests/htools-invalid.test

index d3b6971..34f8d8a 100644 (file)
@@ -1004,16 +1004,19 @@ TEST_FILES = \
        test/data/htools/hbal-split-insts.data \
        test/data/htools/invalid-node.data \
        test/data/htools/missing-resources.data \
+       test/data/htools/multiple-master.data \
        test/data/htools/n1-failure.data \
        test/data/htools/rapi/groups.json \
        test/data/htools/rapi/info.json \
        test/data/htools/rapi/instances.json \
        test/data/htools/rapi/nodes.json \
+       test/data/htools/unique-reboot-order.data \
        test/hs/shelltests/htools-balancing.test \
        test/hs/shelltests/htools-basic.test \
        test/hs/shelltests/htools-dynutil.test \
        test/hs/shelltests/htools-excl.test \
        test/hs/shelltests/htools-hail.test \
+       test/hs/shelltests/htools-hroller.test \
        test/hs/shelltests/htools-hspace.test \
        test/hs/shelltests/htools-invalid.test \
        test/hs/shelltests/htools-multi-group.test \
similarity index 61%
copy from test/data/htools/empty-cluster.data
copy to test/data/htools/multiple-master.data
index d25526f..35aa1b7 100644 (file)
@@ -1,5 +1,8 @@
 group-01|fake-uuid-01|preferred|
 
+node-01-001|91552|0|91424|953674|953674|16|M|fake-uuid-01|1
+node-01-002|91552|0|91296|953674|953674|16|N|fake-uuid-01|1
+node-01-003|91552|0|91296|953674|953674|16|M|fake-uuid-01|1
 
 
 
similarity index 55%
copy from test/data/htools/clean-nonzero-score.data
copy to test/data/htools/unique-reboot-order.data
index 72762fa..d4261c9 100644 (file)
@@ -1,14 +1,11 @@
 group-01|fake-uuid-01|preferred|
 
-node-01-001|91552|0|91424|953674|953674|16|N|fake-uuid-01|1
+node-01-001|91552|0|91424|953674|953674|16|M|fake-uuid-01|1
 node-01-002|91552|0|91296|953674|953674|16|N|fake-uuid-01|1
 node-01-003|91552|0|91296|953674|953674|16|N|fake-uuid-01|1
 
-new-0|128|1024|1|running|Y|node-01-003||diskless||1
-new-1|128|1024|1|running|Y|node-01-002||diskless||1
-new-2|128|1024|1|running|Y|node-01-001||diskless||1
-new-3|128|1024|1|running|Y|node-01-003||diskless||1
-new-4|128|1024|1|running|Y|node-01-002||diskless||1
+new-0|128|1152|1|running|Y|node-01-001|node-01-002|drbd||1
+new-1|128|1152|1|running|Y|node-01-002|node-01-003|drbd||1
 
 
 |128,1,1024,1,1,1|128,1,1024,1,1,1|32768,8,1048576,16,8,12|diskless,file,sharedfile,plain,blockdev,drbd,rbd,ext|4.0|32.0
diff --git a/test/hs/shelltests/htools-hroller.test b/test/hs/shelltests/htools-hroller.test
new file mode 100644 (file)
index 0000000..8a2e133
--- /dev/null
@@ -0,0 +1,5 @@
+./test/hs/hroller --no-headers -t $TESTDATA_DIR/unique-reboot-order.data
+>>>
+node-01-002
+node-01-003,node-01-001
+>>>= 0
index c2bbe3e..3354318 100644 (file)
@@ -62,6 +62,12 @@ Error: This program doesn't take any arguments.
 >>>2/Error: Cannot create node graph/
 >>>=1
 
+# hroller should reject a configuration with more than one master,
+# even with -f
+./test/hs/hroller -f -t$TESTDATA_DIR/multiple-master.data
+>>>2/Error: Found more than one master node/
+>>>=1
+
 # hbal doesn't accept invalid priority
 ./test/hs/hbal --priority=abc
 >>>2/Unknown priority/