Only select a test file if it's not empty (#3483)

This is to protect against accidentally selecting a zero sized file for item read tests. This may happen if another CI test is running in parallel which creates a bunch of empty files in the same drive.

---

#### Does this PR need a docs update or release note?

- [ ]  Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x]  No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [x] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* #<issue>

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [ ]  Unit test
- [x] 💚 E2E
This commit is contained in:
Abhishek Pandey 2023-05-23 12:15:53 -07:00 committed by GitHub
parent d0354a9971
commit bdebaa5f29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,7 +68,8 @@ func (suite *ItemIntegrationSuite) TestItemReader_oneDrive() {
defer flush()
var driveItem models.DriveItemable
// This item collector tries to find "a" drive item that is a file to test the reader function
// This item collector tries to find "a" drive item that is a non-empty
// file to test the reader function
itemCollector := func(
_ context.Context,
_, _ string,
@ -81,7 +82,7 @@ func (suite *ItemIntegrationSuite) TestItemReader_oneDrive() {
_ *fault.Bus,
) error {
for _, item := range items {
if item.GetFile() != nil {
if item.GetFile() != nil && ptr.Val(item.GetSize()) > 0 {
driveItem = item
break
}