From 2a1737ebf399e7dca9cc6c26dfca810ef39be460 Mon Sep 17 00:00:00 2001
From: Klaus Aehlig <aehlig@google.com>
Date: Wed, 8 May 2013 18:21:59 +0200
Subject: [PATCH] Add a test for online rolling reboot scheduling

In the example configuration, the graph constructed by just connecting
primary and secondary instances is two-colorable. However, when taking
conflicting locations of secondary nodes into account, three reboot
groups are needed. Moreover, these reboot groups are not subordinated
to any two-coloring of the first-mentioned graph.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>
---
 Makefile.am                            |  1 +
 test/data/htools/hroller-online.data   | 14 ++++++++++++++
 test/hs/shelltests/htools-hroller.test | 12 ++++++++++++
 3 files changed, 27 insertions(+)
 create mode 100644 test/data/htools/hroller-online.data

diff --git a/Makefile.am b/Makefile.am
index ee1d1c423..a6fe1f959 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1028,6 +1028,7 @@ TEST_FILES = \
 	test/data/htools/rapi/info.json \
 	test/data/htools/rapi/instances.json \
 	test/data/htools/rapi/nodes.json \
+	test/data/htools/hroller-online.data \
 	test/data/htools/unique-reboot-order.data \
 	test/hs/shelltests/htools-balancing.test \
 	test/hs/shelltests/htools-basic.test \
diff --git a/test/data/htools/hroller-online.data b/test/data/htools/hroller-online.data
new file mode 100644
index 000000000..e6399ae0b
--- /dev/null
+++ b/test/data/htools/hroller-online.data
@@ -0,0 +1,14 @@
+group-01|fake-uuid-01|preferred|
+
+node-01-001|91552|0|91424|953674|953674|16|N|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
+node-01-004|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-003|node-01-002|drbd||1
+new-2|128|1152|1|running|Y|node-01-004|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
index 1a32696fa..36cf41210 100644
--- a/test/hs/shelltests/htools-hroller.test
+++ b/test/hs/shelltests/htools-hroller.test
@@ -22,3 +22,15 @@ node-01-001
 ./test/hs/hroller --node-tags=blue --no-headers -t $TESTDATA_DIR/multiple-tags.data
 >>>/^node-01-00.,node-01-00.,node-01-00.$/
 >>>= 0
+
+./test/hs/hroller --no-headers --offline-maintenance -t $TESTDATA_DIR/hroller-online.data
+>>>/node-01-00.,node-01-00.
+node-01-001,node-01-003/
+>>>= 0
+
+./test/hs/hroller --no-headers -t $TESTDATA_DIR/hroller-online.data
+>>>/node-01-00.,node-01-00.
+node-01-002
+node-01-003/
+>>>= 0
+
-- 
GitLab