Tests: Fix vagrant tests to ignore progress bar in assertions

This commit is contained in:
Alexander Reelsen 2016-06-30 09:08:31 +02:00
parent c77dc4a82c
commit 8b43480b94
1 changed files with 7 additions and 6 deletions

View File

@ -418,17 +418,18 @@ fi
@test "[$GROUP] install jvm-example with different logging modes and check output" { @test "[$GROUP] install jvm-example with different logging modes and check output" {
local relativePath=${1:-$(readlink -m jvm-example-*.zip)} local relativePath=${1:-$(readlink -m jvm-example-*.zip)}
sudo -E -u $ESPLUGIN_COMMAND_USER "$ESHOME/bin/elasticsearch-plugin" install "file://$relativePath" > /tmp/plugin-cli-output sudo -E -u $ESPLUGIN_COMMAND_USER "$ESHOME/bin/elasticsearch-plugin" install "file://$relativePath" > /tmp/plugin-cli-output
local loglines=$(cat /tmp/plugin-cli-output | wc -l) # exclude progress line
local loglines=$(cat /tmp/plugin-cli-output | grep -v "^[[:cntrl:]]" | wc -l)
if [ "$GROUP" == "TAR PLUGINS" ]; then if [ "$GROUP" == "TAR PLUGINS" ]; then
# tar extraction does not create the plugins directory so the plugin tool will print an additional line that the directory will be created # tar extraction does not create the plugins directory so the plugin tool will print an additional line that the directory will be created
[ "$loglines" -eq "3" ] || { [ "$loglines" -eq "3" ] || {
echo "Expected 3 lines but the output was:" echo "Expected 3 lines excluding progress bar but the output had $loglines lines and was:"
cat /tmp/plugin-cli-output cat /tmp/plugin-cli-output
false false
} }
else else
[ "$loglines" -eq "2" ] || { [ "$loglines" -eq "2" ] || {
echo "Expected 2 lines but the output was:" echo "Expected 2 lines excluding progress bar but the output had $loglines lines and was:"
cat /tmp/plugin-cli-output cat /tmp/plugin-cli-output
false false
} }
@ -437,16 +438,16 @@ fi
local relativePath=${1:-$(readlink -m jvm-example-*.zip)} local relativePath=${1:-$(readlink -m jvm-example-*.zip)}
sudo -E -u $ESPLUGIN_COMMAND_USER ES_JAVA_OPTS="-Des.logger.level=DEBUG" "$ESHOME/bin/elasticsearch-plugin" install "file://$relativePath" > /tmp/plugin-cli-output sudo -E -u $ESPLUGIN_COMMAND_USER ES_JAVA_OPTS="-Des.logger.level=DEBUG" "$ESHOME/bin/elasticsearch-plugin" install "file://$relativePath" > /tmp/plugin-cli-output
local loglines=$(cat /tmp/plugin-cli-output | wc -l) local loglines=$(cat /tmp/plugin-cli-output | grep -v "^[[:cntrl:]]" | wc -l)
if [ "$GROUP" == "TAR PLUGINS" ]; then if [ "$GROUP" == "TAR PLUGINS" ]; then
[ "$loglines" -gt "3" ] || { [ "$loglines" -gt "3" ] || {
echo "Expected more than 3 lines but the output was:" echo "Expected more than 3 lines excluding progress bar but the output had $loglines lines and was:"
cat /tmp/plugin-cli-output cat /tmp/plugin-cli-output
false false
} }
else else
[ "$loglines" -gt "2" ] || { [ "$loglines" -gt "2" ] || {
echo "Expected more than 2 lines but the output was:" echo "Expected more than 2 lines excluding progress bar but the output had $loglines lines and was:"
cat /tmp/plugin-cli-output cat /tmp/plugin-cli-output
false false
} }