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 <[email protected]>
---
 Makefile.am                               |  3 +++
 test/data/htools/multiple-master.data     | 10 ++++++++++
 test/data/htools/unique-reboot-order.data | 12 ++++++++++++
 test/hs/shelltests/htools-hroller.test    |  5 +++++
 test/hs/shelltests/htools-invalid.test    |  6 ++++++
 5 files changed, 36 insertions(+)
 create mode 100644 test/data/htools/multiple-master.data
 create mode 100644 test/data/htools/unique-reboot-order.data
 create mode 100644 test/hs/shelltests/htools-hroller.test

diff --git a/Makefile.am b/Makefile.am
index d3b6971..34f8d8a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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 \
diff --git a/test/data/htools/multiple-master.data 
b/test/data/htools/multiple-master.data
new file mode 100644
index 0000000..35aa1b7
--- /dev/null
+++ b/test/data/htools/multiple-master.data
@@ -0,0 +1,10 @@
+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
+
+
+
+|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
+group-01|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/data/htools/unique-reboot-order.data 
b/test/data/htools/unique-reboot-order.data
new file mode 100644
index 0000000..d4261c9
--- /dev/null
+++ b/test/data/htools/unique-reboot-order.data
@@ -0,0 +1,12 @@
+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|N|fake-uuid-01|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
+group-01|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
index 0000000..8a2e133
--- /dev/null
+++ b/test/hs/shelltests/htools-hroller.test
@@ -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
diff --git a/test/hs/shelltests/htools-invalid.test 
b/test/hs/shelltests/htools-invalid.test
index c2bbe3e..3354318 100644
--- a/test/hs/shelltests/htools-invalid.test
+++ b/test/hs/shelltests/htools-invalid.test
@@ -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/
-- 
1.8.2.1

Reply via email to