Python PostCommits produce too many spanner databases
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:
- Only run Spanner ITs in one Python version's PostCommit.
- 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.
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 ofit_postcommitand into a separatespannerio_itsuite (thespannerioITtasks), run only frompython37PostCommit. That is the first avenue suggested above. - One database per class. The native ITs create their database once in
setUpClassand drop it intearDownClass(read, write). - The cross-language IT uses the emulator.
xlang_spannerio_it_test.pystill creates a database per test, but against the Spanner emulator unless--use_real_spanneris passed (L99). Nothing in the repo passes that flag, and the test skips itself on Dataflow (L108). The Xlang GCP PostCommits collect it through itsuses_gcp_java_expansion_servicemarker.
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.