Simplify ShowProgress unit test

Due to variable CPU load on zuul site, there is a possibility that
progress bar will dump its intermittent state during ShowProgress
test execution. This patch simplifies a bit assertion logic so only
"Completed" state of progress bar will matter, possible intermittent
output will be omitted from assertion.

Change-Id: I5369bf57752df928c0bd9f223cfaa17f8f0b0018
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
This commit is contained in:
Ruslan Aliev 2020-10-21 17:34:13 -05:00
parent 113628336f
commit 0a1bb41e2d
2 changed files with 1 additions and 10 deletions

View File

@ -19,7 +19,6 @@ import (
"fmt"
"io"
"io/ioutil"
"regexp"
"strings"
"testing"
@ -276,10 +275,6 @@ func TestShowProgress(t *testing.T) {
writer := bytes.NewBuffer(nil)
err = showProgress(reader, writer)
require.NoError(t, err)
expected, err := ioutil.ReadFile(tt.output)
require.NoError(t, err)
space := regexp.MustCompile(`\s+`)
assert.Equal(t, space.ReplaceAllString(string(expected), " "),
space.ReplaceAllString(writer.String(), " "))
assert.Contains(t, writer.String(), "Completed")
}
}

View File

@ -1,4 +0,0 @@
Retrieving base packages ... Done
Completed [----------------------------] 100.00%
Completed [----------------------------] 100.00%
Creating 4.0 filesystem on /root/LIVE_BOOT/image/live/filesystem.squashfs, block size 131072.