beam icon indicating copy to clipboard operation
beam copied to clipboard

Python PostCommits produce too many spanner databases

Open damccorm opened this issue 4 years ago • 1 comments

There are ~30 Python PostCommit tests that create and destroy a Spanner Database. Each running across 3 PostCommits. We should reduce the number of tests that do this.

A couple of avenues:

  1. Only run Spanner ITs in one Python version's PostCommit.
  2. Verify more logic in spannerio_test.py (as opposed to spannerio_\*_it_test.py), which uses a mock rather than prod Spanner. We can still have a few ITs, but we don't need to verify everything there.

Imported from Jira BEAM-13373. Original Jira may contain additional context. Reported by: bhulette. This issue has child subcomponents which were not migrated over. See the original Jira for more information.

damccorm avatar Jun 04 '22 21:06 damccorm

This looks resolved on current master (8582779203d), so it may be ready to close:

  • One Python version only. #16112 (titled [BEAM-13373], this issue's Jira) took the native SpannerIO ITs out of it_postcommit and into a separate spannerio_it suite (the spannerioIT tasks), run only from python37PostCommit. That is the first avenue suggested above.
  • One database per class. The native ITs create their database once in setUpClass and drop it in tearDownClass (read, write).
  • The cross-language IT uses the emulator. xlang_spannerio_it_test.py still creates a database per test, but against the Spanner emulator unless --use_real_spanner is passed (L99). Nothing in the repo passes that flag, and the test skips itself on Dataflow (L108). The Xlang GCP PostCommits collect it through its uses_gcp_java_expansion_service marker.

One related thing a maintainer may want to know: when #27194 removed Python 3.7 support, it deleted python37PostCommit along with its spannerioIT dependencies, and they weren't moved to another version. Today python311PostCommit through python314PostCommit in build.gradle.kts don't depend on spannerioIT, and nothing else references it. So the native spannerio_it tests no longer run in any PostCommit. That fully removes the database load, but it also means the native IO's ITs are unexercised. Given #35860 plans to deprecate the native IO, that may be fine; I'm only noting it.

I checked this by reading the code and the Gradle wiring; I didn't run the ITs, since they need GCP.

jonathansudhakar1 avatar Nov 16 '26 17:11 jonathansudhakar1