From 624418326197cce24167050d107dea35847c40da Mon Sep 17 00:00:00 2001
From: Klaus Aehlig <aehlig@google.com>
Date: Fri, 3 May 2013 11:12:58 +0200
Subject: [PATCH] Add a test demonstrating the --node-tags option of hroller

The example is a cluster of 6 nodes, paired into 3 group by three
instances. So the whole cluster would need two reboot groups. The two
tags select, in two different ways, one node of each group. So, when
restricting to one tag, a single reboot group suffices, but no
coloring of the whole cluster would achieve this.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 Makefile.am                            |  1 +
 test/data/htools/multiple-tags.data    | 16 ++++++++++++++++
 test/hs/shelltests/htools-hroller.test |  8 ++++++++
 3 files changed, 25 insertions(+)
 create mode 100644 test/data/htools/multiple-tags.data

diff --git a/Makefile.am b/Makefile.am
index 98b7cb48b..ee1d1c423 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1022,6 +1022,7 @@ TEST_FILES = \
 	test/data/htools/invalid-node.data \
 	test/data/htools/missing-resources.data \
 	test/data/htools/multiple-master.data \
+	test/data/htools/multiple-tags.data \
 	test/data/htools/n1-failure.data \
 	test/data/htools/rapi/groups.json \
 	test/data/htools/rapi/info.json \
diff --git a/test/data/htools/multiple-tags.data b/test/data/htools/multiple-tags.data
new file mode 100644
index 000000000..35cb17ac2
--- /dev/null
+++ b/test/data/htools/multiple-tags.data
@@ -0,0 +1,16 @@
+group-01|fake-uuid-01|preferred|
+
+node-01-001|91552|0|91424|953674|953674|16|M|fake-uuid-01|1|red
+node-01-002|91552|0|91296|953674|953674|16|N|fake-uuid-01|1|blue
+node-01-003|91552|0|91296|953674|953674|16|N|fake-uuid-01|1|
+node-01-004|91552|0|91296|953674|953674|16|N|fake-uuid-01|1|blue,red
+node-01-005|91552|0|91296|953674|953674|16|N|fake-uuid-01|1|red
+node-01-006|91552|0|91296|953674|953674|16|N|fake-uuid-01|1|blue
+
+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-004|drbd||1
+new-1|128|1152|1|running|Y|node-01-005|node-01-006|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 82ad782c4..925ff9d72 100644
--- a/test/hs/shelltests/htools-hroller.test
+++ b/test/hs/shelltests/htools-hroller.test
@@ -14,3 +14,11 @@ node-01-003,node-01-001
 node-01-002
 node-01-001
 >>>= 0
+
+./test/hs/hroller --node-tags=red --no-headers -t $TESTDATA_DIR/multiple-tags.data
+>>>/node-01-00.,node-01-00.,node-01-001/
+>>>= 0
+
+./test/hs/hroller --node-tags=blue --no-headers -t $TESTDATA_DIR/multiple-tags.data
+>>>/node-01-00.,node-01-00.,node-01-00?/
+>>>= 0
-- 
GitLab