Skip to content

test(downloader): scale down test object and chunk sizes to speed up tests#4814

Open
geertj wants to merge 1 commit into
GoogleCloudPlatform:masterfrom
geertj:downloader-test-speedup
Open

test(downloader): scale down test object and chunk sizes to speed up tests#4814
geertj wants to merge 1 commit into
GoogleCloudPlatform:masterfrom
geertj:downloader-test-speedup

Conversation

@geertj

@geertj geertj commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Optimized the test suite for the downloader package by scaling down the mock GCS object sizes and parallel/sparse download chunk sizes, reducing execution time from ~26s down to ~4.3s (a ~6x speedup).

Also fixed a race condition in Test_Download_CtxCancelled by reducing the timeout to 1ns to ensure immediate expiration and waiting on the async job completion channel (doneCh) before performing assertions on the downloaded file.

TAG=agy
CONV=8c7b5ab6-91ae-4a84-911e-1788917d5ab8

@geertj geertj requested a review from a team as a code owner June 27, 2026 21:07
@geertj geertj requested a review from raj-prince June 27, 2026 21:07
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on optimizing the downloader package's test suite to improve developer productivity by reducing execution time. It also includes a critical fix for a race condition in one of the asynchronous download tests to ensure test stability.

Highlights

  • Test Optimization: Significantly reduced test execution time by scaling down mock GCS object sizes and download chunk sizes, resulting in a ~6x speedup.
  • Race Condition Fix: Resolved a race condition in Test_Download_CtxCancelled by tightening the timeout and ensuring the async job completion channel is properly awaited before assertions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request scales down the test object sizes, chunk sizes, and offsets across several downloader test files (job_test.go, parallel_downloads_job_test.go, and sparse_downloads_job_test.go) to optimize test execution. Additionally, it updates Test_Download_CtxCancelled to wait for the background async download to complete, preventing potential test flakiness. There are no review comments, so I have no feedback to provide.

@geertj geertj force-pushed the downloader-test-speedup branch from 7c7d834 to a8b85a4 Compare June 27, 2026 22:03
@geertj geertj requested a review from meet2mky as a code owner June 27, 2026 22:03
…tests

Optimized the test suite for the downloader package by scaling down the mock
GCS object sizes and parallel/sparse download chunk sizes, reducing execution
time from ~26s down to ~4.3s (a ~6x speedup).

Also fixed a race condition in Test_Download_CtxCancelled by reducing the
timeout to 1ns to ensure immediate expiration and waiting on the async job
completion channel (doneCh) before performing assertions on the downloaded
file.

TAG=agy
CONV=8c7b5ab6-91ae-4a84-911e-1788917d5ab8
@geertj geertj force-pushed the downloader-test-speedup branch from a8b85a4 to e3308f6 Compare June 27, 2026 22:54
@geertj geertj requested a review from charith87 June 30, 2026 11:24
raj-prince
raj-prince previously approved these changes Jul 9, 2026
@raj-prince raj-prince changed the base branch from master to python_dependencies July 9, 2026 12:47
@raj-prince raj-prince requested a review from kislaykishore as a code owner July 9, 2026 12:47
@raj-prince raj-prince changed the base branch from python_dependencies to master July 9, 2026 12:47
@raj-prince raj-prince dismissed their stale review July 9, 2026 12:47

The base branch was changed.

@raj-prince raj-prince self-requested a review July 9, 2026 12:48
@raj-prince

raj-prince commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

@geertj, tried triggering the CI checks from UI by changing the base branch, but got into bad state. Maybe you can try adding empty-commit once to re-trigger freshly.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants