Skip to content

Core: Fix flaky test by ensuring generateContentLength returns positive value#16539

Open
lilei1128 wants to merge 1 commit into
apache:mainfrom
lilei1128:flaky-case
Open

Core: Fix flaky test by ensuring generateContentLength returns positive value#16539
lilei1128 wants to merge 1 commit into
apache:mainfrom
lilei1128:flaky-case

Conversation

@lilei1128
Copy link
Copy Markdown
Contributor

generateContentLength() used random().nextInt(10_000) which could return 0.
When a DV's contentSizeInBytes is 0, SnapshotSummary skips writing the
"added-files-size" field due to the setIf(addedSize > 0, ...) guard,
causing testFileSizeSummaryWithDVs to fail with hasSize(19) vs actual 18.

Fix by returning 1 + random().nextInt(10_000) to guarantee a positive value.

@github-actions github-actions Bot added the core label May 23, 2026
@lilei1128
Copy link
Copy Markdown
Contributor Author

image

@lilei1128
Copy link
Copy Markdown
Contributor Author

close #16542

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant