There are four tests:
* the simple one (one instance failover)
* more complex (concerning two instances)
* multiple desired locations (all can be satisfied)
* multiple desired locations (some of them can't be satisfied)

Signed-off-by: Oleg Ponomarev <onponoma...@gmail.com>
---
 test/data/htools/hbal-desiredlocation-1.data |  9 +++++++++
 test/data/htools/hbal-desiredlocation-2.data | 11 +++++++++++
 test/data/htools/hbal-desiredlocation-3.data | 12 ++++++++++++
 test/data/htools/hbal-desiredlocation-4.data | 11 +++++++++++
 test/hs/shelltests/htools-hbal.test          | 29 ++++++++++++++++++++++++++++
 5 files changed, 72 insertions(+)
 create mode 100644 test/data/htools/hbal-desiredlocation-1.data
 create mode 100644 test/data/htools/hbal-desiredlocation-2.data
 create mode 100644 test/data/htools/hbal-desiredlocation-3.data
 create mode 100644 test/data/htools/hbal-desiredlocation-4.data

diff --git a/test/data/htools/hbal-desiredlocation-1.data 
b/test/data/htools/hbal-desiredlocation-1.data
new file mode 100644
index 0000000..d02ac7a
--- /dev/null
+++ b/test/data/htools/hbal-desiredlocation-1.data
@@ -0,0 +1,9 @@
+group-01|fake-uuid-01|preferred||
+
+node-01|16384|0|15360|409600|357800|16|N|fake-uuid-01|1|power:a
+node-02|16384|0|16384|409600|357800|16|N|fake-uuid-01|1|power:b
+
+inst1|1024|51200|1|running|Y|node-01|node-02|drbd|power:b|1
+
+htools:desiredlocation:power
+htools:nlocation:power
diff --git a/test/data/htools/hbal-desiredlocation-2.data 
b/test/data/htools/hbal-desiredlocation-2.data
new file mode 100644
index 0000000..0b2eeb0
--- /dev/null
+++ b/test/data/htools/hbal-desiredlocation-2.data
@@ -0,0 +1,11 @@
+group-01|fake-uuid-01|preferred||
+
+node-01|16384|0|14236|409600|306600|16|N|fake-uuid-01|1|power:b
+node-02|16384|0|16384|409600|306600|16|N|fake-uuid-01|1|power:a
+node-03|16384|0|16384|409600|409600|16|N|fake-uuid-01|1|
+
+inst1|1024|51200|1|running|Y|node-01|node-02|drbd|power:a|1
+inst2|1024|51200|1|running|Y|node-01|node-02|drbd|power:b|1
+
+htools:desiredlocation:power
+htools:nlocation:power
diff --git a/test/data/htools/hbal-desiredlocation-3.data 
b/test/data/htools/hbal-desiredlocation-3.data
new file mode 100644
index 0000000..e90a90f
--- /dev/null
+++ b/test/data/htools/hbal-desiredlocation-3.data
@@ -0,0 +1,12 @@
+group-01|fake-uuid-01|preferred||
+
+node-01|16384|0|15360|409600|307200|16|N|fake-uuid-01|1|power:c,computer:l
+node-02|16384|0|16384|409600|307200|16|N|fake-uuid-01|1|power:b
+node-03|16384|0|16384|409600|409600|16|N|fake-uuid-01|1|power:b,computer:s
+
+inst1|1024|102400|1|running|Y|node-01|node-02|drbd|power:b,computer:s|1
+
+htools:nlocation:power
+htools:nlocation:computer
+htools:desiredlocation:power
+htools:desiredlocation:computer
diff --git a/test/data/htools/hbal-desiredlocation-4.data 
b/test/data/htools/hbal-desiredlocation-4.data
new file mode 100644
index 0000000..90b9437
--- /dev/null
+++ b/test/data/htools/hbal-desiredlocation-4.data
@@ -0,0 +1,11 @@
+group-01|fake-uuid-01|preferred||
+
+node-01|16384|0|15360|409600|357800|16|N|fake-uuid-01|1|power:a,computer:l
+node-02|16384|0|16384|409600|357800|16|N|fake-uuid-01|1|power:b,computer:s
+
+inst1|1024|51200|1|running|Y|node-01|node-02|drbd|power:b,computer:s,computer:l|1
+
+htools:nlocation:power
+htools:nlocation:computer
+htools:desiredlocation:power
+htools:desiredlocation:computer
diff --git a/test/hs/shelltests/htools-hbal.test 
b/test/hs/shelltests/htools-hbal.test
index e3baf37..d6e15ad 100644
--- a/test/hs/shelltests/htools-hbal.test
+++ b/test/hs/shelltests/htools-hbal.test
@@ -25,6 +25,35 @@
  node-04    0/
 >>>= 0
 
+./test/hs/hbal --print-nodes=name,pcnt -t 
$TESTDATA_DIR/hbal-desiredlocation-1.data
+>>>2/Final cluster status:
+ Name    pcnt
+ node-01    0
+ node-02    1/
+>>>= 0
+
+./test/hs/hbal --print-nodes=name,pcnt -t 
$TESTDATA_DIR/hbal-desiredlocation-2.data
+>>>2/Final cluster status:
+ Name    pcnt
+ node-01    1
+ node-02    1/
+ node-03    0/
+>>>= 0
+
+./test/hs/hbal --print-nodes=name,pcnt -t 
$TESTDATA_DIR/hbal-desiredlocation-3.data
+>>>2/Final cluster status:
+ Name    pcnt
+ node-01    0
+ node-02    0
+ node-03    1/
+>>>= 0
+
+./test/hs/hbal --print-nodes=name,pcnt -t 
$TESTDATA_DIR/hbal-desiredlocation-4.data
+>>>2/Final cluster status:
+ Name    pcnt
+ node-01    0
+ node-02    1/
+>>>= 0
 
 ./test/hs/hbal -t $TESTDATA_DIR/hbal-location-1.data
 >>>/Solution length=[1-9]/
-- 
1.9.1

Reply via email to