Skip to content

[MAINTENANCE] Run the GCS docs snippet tests - #12059

Merged
joshua-stauffer merged 8 commits into
developfrom
m/gcs-docs-snippet-tests
Aug 12, 2026
Merged

[MAINTENANCE] Run the GCS docs snippet tests#12059
joshua-stauffer merged 8 commits into
developfrom
m/gcs-docs-snippet-tests

Conversation

@joshua-stauffer

@joshua-stauffer joshua-stauffer commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Un-skips the GCS docs snippet fixtures and gates them on a new --gcs pytest flag, which docs-creds-needed now requests.

Two independent gates each made these fixtures unreachable, so both had to go:

  • The unconditional cloud-object-store skip. _check_for_skipped_tests skipped anything backed by S3, GCS, or Azure Blob outright. S3 and Azure Blob stay in that block — neither has storage or a live credential yet — but GCS now has both, so the blanket gate no longer applies to it.
  • The --bigquery gate. GCS was gated on --bigquery, which made GCS coverage silently conditional on BigQuery's health. It now has its own --gcs flag, which is inert for build_test_backends_list and so cannot abort collection the way the credential-validating flags can.

Two further fixes fell out of actually running them:

  • docs-creds-needed now declares requirements-dev-gcs.txt explicitly. It was getting google-cloud-storage transitively from the BigQuery requirements — the same GCS-on-BigQuery coupling this PR removes at the flag level, still present one layer down.
  • The Spark GCS guide is migrated to the current asset API. It passed batching_regex into add_csv_asset and called build_batch_request on the asset, both of which predate batch definitions, so the asset now rejects batching_regex as an extra field. The pandas guide beside it was migrated when that API changed; this one was not, and nothing noticed because the fixture had never run. It has been shipping instructions that raise.

Why

The GCS docs snippets are user-facing documentation that has not been executed in CI for the duration of the CI transition. The bucket (#12056), the credentials (#12057), and the datasource-level tests (#12058) are all restored; this reconnects the docs snippets to them.

User impact

The Spark-on-GCS guide no longer documents an API call that raises. Everything else is test and CI wiring.

How to review

All pandas GCS fixtures pass. The bucket needs exactly three objects under data/taxi_yellow_tripdata_samples/yellow_tripdata_sample_2019-01/02/03.csv — because partitioned_on_datetime.py asserts an exact batch count of 3.

The Spark GCS fixtures remain skipped, deliberately. Requesting --gcs from docs-spark gets them past their Python-side gates and straight into:

org.apache.hadoop.fs.UnsupportedFileSystemException: No FileSystem for scheme "gs"

Spark resolves gs:// only with the GCS Hadoop connector on the JVM classpath. That jar must exist when the JVM starts, so no requirements file can supply it — it needs PYSPARK_SUBMIT_ARGS or a pre-staged jar plus fs.gs.impl and service-account Hadoop config. Until that exists, requesting the flag converts a skip into a failure and buys nothing. The gap is documented in tests/integration/test_definitions/gcs/README.md and beside the flags in tasks.py, rather than being a silent consequence of which leg requests what.

Worth a close look:

  • The --gcs flag is genuinely inert for build_test_backends_list — the concern is a flag that aborts collection rather than skipping.
  • S3 and Azure Blob are still skipped unconditionally; only GCS was removed from that tuple.
  • Watch for skips rather than failures on the pandas side. A green run of zero tests is the failure mode worth guarding against.

The five GCS docs snippet fixtures were unreachable for two independent
reasons in the test wiring, both of which had to be fixed for any of them
to run.

Removes GCS from the unconditional cloud-object-store skip in the docs
snippet runner. S3 and Azure Blob stay in that block -- neither has storage
nor a live credential yet -- but GCS now has both, so the blanket gate no
longer applies to it.

Gates GCS on its own --gcs flag instead of --bigquery, and requests that
flag from docs-creds-needed. Sharing --bigquery made GCS coverage silently
conditional on BigQuery's health, and turning --bigquery on here would also
open a real BigQuery connection at collection time. The new flag is inert
for build_test_backends_list, so it cannot abort a session the way the
credential-validating flags can.

The workflow half of this change -- writing the GCP credentials file for the
docs-snippets job and pointing GOOGLE_APPLICATION_CREDENTIALS at an absolute
path -- is in #12057 and has to land first. Because the workflow definition
is read from the base branch, these tests cannot pass until it does.
@netlify

netlify Bot commented Aug 12, 2026

Copy link
Copy Markdown

Deploy Preview for niobium-lead-7998 ready!

Name Link
🔨 Latest commit 3fcb9a1
🔍 Latest deploy log https://app.netlify.com/projects/niobium-lead-7998/deploys/6a7cd3e2cd6517000893ed9a
😎 Deploy Preview https://deploy-preview-12059.docs.greatexpectations.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

joshua-stauffer added a commit that referenced this pull request Aug 12, 2026
This branch changes both halves of a pull_request_target workflow: the
workflow definition, which GitHub reads from the base branch, and the test
code, which is checked out from the PR head. Only the code half takes effect
in this PR's own CI run, so enabling the GCS docs snippet tests here made
them run against a job whose credentials setup was still develop's.

Leaving the workflow half alone here keeps this PR a no-op against develop --
it writes a credentials file no test currently reads -- which is what makes it
safe to merge without a CI run that can exercise it. The test wiring moves to
 #12059, which can then be validated against a base branch that already has
this.
The two GCS fixtures that also depend on Spark are reachable only from a leg
that requests both flags. docs-creds-needed requests --gcs without --spark and
docs-spark requested --spark without --gcs, so create_a_data_source_filesystem_gcs_spark
and create_a_data_asset_filesystem_gcs_directory_asset were skipped in both and
nothing reported the gap.

The GCP credentials and bucket are job-level environment, so the docs-spark leg
already has everything it needs to reach the bucket.
docs-spark requests --gcs but installed neither google-cloud-storage nor
anything that depends on it, so the Spark GCS datasources failed to construct
with a missing google dependency.

docs-creds-needed was getting the client transitively from the bigquery
requirements. That works today but reintroduces the coupling this change set
set out to remove -- GCS coverage should not depend on BigQuery's dependency
set staying where it is -- so the requirement is now declared explicitly.
The script still passed batching_regex to add_csv_asset and called
build_batch_request on the asset. Both predate the move to batch definitions,
so the asset now rejects batching_regex as an extra field. The pandas guide
alongside it was migrated at the time; this one was not, and nothing noticed
because the fixture had never run.

Mirrors the pandas guide exactly: the regex moves to
add_batch_definition_monthly, and the batch request comes from the batch
definition.
Requesting --gcs from docs-spark got the fixtures past their Python-side
gates, but Spark reads GCS through gs:// URIs and Hadoop resolves that scheme
only with the GCS connector on the JVM classpath:

    org.apache.hadoop.fs.UnsupportedFileSystemException: No FileSystem for scheme "gs"

The connector is a jar that has to be present when the JVM starts, so it
cannot come from a requirements file. Until the workflow stages it, requesting
the flag converts a skip into a failure and buys nothing, so docs-spark goes
back to requesting --spark alone.

The gap is now recorded in the GCS README and next to the flags themselves,
rather than being a silent consequence of which leg requests what.

The docs-creds-needed GCS requirement stays: that leg does request --gcs, and
the pandas fixtures it covers are passing.
Both GCS guides built a BatchRequest by hand and passed it back to the asset.
BatchDefinition.get_batch is public API and does exactly that internally, so
the intermediate request is machinery the reader never needs to see.

Applied to the pandas guide as well as the spark one: they are sibling guides
demonstrating the same flow, and leaving them on different patterns would be
worse than either pattern on its own.
@joshua-stauffer
joshua-stauffer merged commit 334a058 into develop Aug 12, 2026
55 checks passed
@joshua-stauffer
joshua-stauffer deleted the m/gcs-docs-snippet-tests branch August 12, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant