From 0a1bb41e2d9b152292d719b6a5110ab0d78b3d7c Mon Sep 17 00:00:00 2001 From: Ruslan Aliev Date: Wed, 21 Oct 2020 17:34:13 -0500 Subject: [PATCH] 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 --- pkg/bootstrap/isogen/command_test.go | 7 +------ pkg/bootstrap/isogen/testdata/pb-output-debian | 4 ---- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100755 pkg/bootstrap/isogen/testdata/pb-output-debian diff --git a/pkg/bootstrap/isogen/command_test.go b/pkg/bootstrap/isogen/command_test.go index 5b7a9c677..813349645 100644 --- a/pkg/bootstrap/isogen/command_test.go +++ b/pkg/bootstrap/isogen/command_test.go @@ -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") } } diff --git a/pkg/bootstrap/isogen/testdata/pb-output-debian b/pkg/bootstrap/isogen/testdata/pb-output-debian deleted file mode 100755 index 37e03fe45..000000000 --- a/pkg/bootstrap/isogen/testdata/pb-output-debian +++ /dev/null @@ -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.