-
Iustin Pop authored
This is more of a RFC… Basically most of the shell-based tests are converted from exec+grep to shelltestrunner. Things are not all fine and nice though: - we have dependencies between tests, as some generate some data files needed later; this is not nice, and we depend on serial execution in testrunner - we can still fail with no so nice messages in the offline-test script (when we generate most of the data) But overall, I think the tests are much nicer to define/read/debug: - each test is standalone, with the only dependency being an optional input data file; this is much better than a single monolithic shell script - in case of failures, the failure is clearly shown by shell test, both for exit code and stdout/stderr - shelltest can run in --debug mode, where the exact details are shown much better than the alternative of "set -x" for the shell script Comments welcome! Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
53d4cdf1
htools-balancing.test 1.95 KiB
### std tests
# test basic parsing
./test/hinfo -v -v -p --print-instances $BACKEND_BAL_STD
>>>= 0
./test/hbal -v -v -v -p --print-instances $BACKEND_BAL_STD -G group-01
>>> !/(Nothing to do, exiting|No solution found)/
>>>2 !/(Nothing to do, exiting|No solution found)/
>>>= 0
# test command output
./test/hbal $BACKEND_BAL_STD -G group-01 -C -S $T/simu-rebal.standard
>>> /gnt-instance (failover|migrate|replace-disks)/
>>>= 0
# test saving commands
./test/hbal $BACKEND_BAL_STD -G group-01 -C$T/rebal-cmds.standard
>>>= 0
# and now check the file (depends on previous test)
cat $T/rebal-cmds.standard
>>> /gnt-instance (failover|migrate|replace-disks)/
>>>= 0
# state saved before rebalancing should be identical; depends on the
# previous test
diff -u $T/simu-rebal-merged.standard $T/simu-rebal.standard.original
>>>
>>>= 0
# no double rebalance; depends on previous test
./test/hbal -t $T/simu-rebal.standard.balanced -G group-01
>>> /(Nothing to do, exiting|No solution found)/
>>>= 0
### now tiered tests
# test basic parsing
./test/hinfo -v -v -p --print-instances $BACKEND_BAL_TIER
>>>= 0
./test/hbal -v -v -v -p --print-instances $BACKEND_BAL_TIER -G group-01
>>> !/(Nothing to do, exiting|No solution found)/
>>>2 !/(Nothing to do, exiting|No solution found)/
>>>= 0
# test command output
./test/hbal $BACKEND_BAL_TIER -G group-01 -C -S $T/simu-rebal.tiered
>>> /gnt-instance (failover|migrate|replace-disks)/
>>>= 0
# test saving commands
./test/hbal $BACKEND_BAL_TIER -G group-01 -C$T/rebal-cmds.tiered
>>>= 0
# and now check the file (depends on previous test)
cat $T/rebal-cmds.tiered
>>> /gnt-instance (failover|migrate|replace-disks)/
>>>= 0
# state saved before rebalancing should be identical; depends on the
# previous test
diff -u $T/simu-rebal-merged.tiered $T/simu-rebal.tiered.original
>>>
>>>= 0
# no double rebalance; depends on previous test
./test/hbal -t $T/simu-rebal.tiered.balanced -G group-01
>>> /(Nothing to do, exiting|No solution found)/
>>>= 0