Skip to content

test(storage): add fast open integration tests - #14878

Draft
Dhriti07 wants to merge 1 commit into
fast-open/08-tracing-attributesfrom
fast-open/09-live-tests
Draft

Dhriti07 wants to merge 1 commit into
fast-open/08-tracing-attributesfrom
fast-open/09-live-tests

Conversation

@Dhriti07

Copy link
Copy Markdown
Contributor

9/n of fast open BiDi reads

ITFastOpenTest runs fast open against a zonal bucket on production:

  • byte array, ByteString and channel reads; the byte array test also checks with tracing that readAs was served from the open (cache_status HIT)
  • a 16 MiB read that arrives in many responses
  • more reads on the same session
  • a read starting exactly at the end of the object (empty)
  • a read past the end of the object
  • an object that doesn't exist (404) and a failed precondition (412)
  • closing the session without claiming the fast open read

@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 introduces a new integration test class, ITFastOpenTest, to verify the fast open read functionality for Google Cloud Storage under various scenarios, including partial reads, large objects, and error conditions. The feedback recommends managing the OpenTelemetrySdk instance inside a try-with-resources block in the bytes_areServedFromTheOpen test to ensure it is properly closed and to prevent potential resource leaks.

Comment on lines +87 to +97
OpenTelemetrySdk.builder()
.setTracerProvider(
SdkTracerProvider.builder()
.addSpanProcessor(SimpleSpanProcessor.create(exporter))
.build())
.build();

try (Storage traced =
storage.getOptions().toBuilder().setOpenTelemetry(otel).build().getService();
BlobReadSession session = traced.blobReadSession(blobId, READ_10_TO_20).get(30, SECONDS)) {
byte[] actual = session.readAs(READ_10_TO_20).get(30, SECONDS);

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.

medium

The OpenTelemetrySdk instance is not closed after the test finishes. Since OpenTelemetrySdk implements AutoCloseable, it should be managed within a try-with-resources block to ensure that its tracer provider and associated span processors are properly shut down and do not leak resources (such as threads or memory) between test runs.

Suggested change
OpenTelemetrySdk.builder()
.setTracerProvider(
SdkTracerProvider.builder()
.addSpanProcessor(SimpleSpanProcessor.create(exporter))
.build())
.build();
try (Storage traced =
storage.getOptions().toBuilder().setOpenTelemetry(otel).build().getService();
BlobReadSession session = traced.blobReadSession(blobId, READ_10_TO_20).get(30, SECONDS)) {
byte[] actual = session.readAs(READ_10_TO_20).get(30, SECONDS);
try (OpenTelemetrySdk otel =
OpenTelemetrySdk.builder()
.setTracerProvider(
SdkTracerProvider.builder()
.addSpanProcessor(SimpleSpanProcessor.create(exporter))
.build())
.build();
Storage traced =
storage.getOptions().toBuilder().setOpenTelemetry(otel).build().getService();
BlobReadSession session = traced.blobReadSession(blobId, READ_10_TO_20).get(30, SECONDS)) {
References
  1. Use try-with-resources to manage closeable resources in tests to ensure they are safely closed and prevent resource leaks.

@Dhriti07
Dhriti07 force-pushed the fast-open/09-live-tests branch from da9302e to e1a8b2f Compare October 31, 2026 18:48
@Dhriti07
Dhriti07 force-pushed the fast-open/08-tracing-attributes branch from e740d72 to 540e2ca Compare October 31, 2026 18:48
Ninth step of fast open BiDi reads (go/fast-open-bidi-read, b/552263062).

ITFastOpenTest runs fast open against a zonal (RAPID) bucket on production:

- byte array, ByteString and channel reads; the byte array test also checks
  with tracing that readAs was served from the open (cache_status HIT)
- a 16 MiB read that arrives in many responses
- more reads on the same session
- a read starting exactly at the end of the object (empty)
- a read past the end of the object
- an object that doesn't exist (404) and a failed precondition (412)
- closing the session without claiming the fast open read

Production reports a fast open read past the end of the object on that read
only: the open succeeds and the matching readAs fails with OUT_OF_RANGE. The
test pins this.
@Dhriti07
Dhriti07 force-pushed the fast-open/08-tracing-attributes branch from 540e2ca to 6bd1b9a Compare November 1, 2026 12:01
@Dhriti07
Dhriti07 force-pushed the fast-open/09-live-tests branch from e1a8b2f to 1e3110b Compare November 1, 2026 12:01

This branch has not been deployed

No deployments
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.

1 participant