storagenode/piecestore: update endpoint_test TestDownload to avoid index out of range runtime errors

Change-Id: Ib3c166a1db84f4caafa970eb800a169d35ba3a54
This commit is contained in:
Jennifer Johnson 2021-04-07 13:34:35 -04:00
parent 71072eb593
commit 444b1f4757

View File

@ -286,8 +286,13 @@ func TestDownload(t *testing.T) {
}
err = downloader.Close()
if len(tt.errs) > 0 {
numErrs := len(tt.errs)
if numErrs > 0 {
require.Error(t, err)
}
if numErrs == 1 {
require.True(t, strings.Contains(err.Error(), tt.errs[0]))
} else if numErrs == 2 {
require.True(t, strings.Contains(err.Error(), tt.errs[0]) || strings.Contains(err.Error(), tt.errs[1]), err.Error())
} else {
require.NoError(t, err)