nielm commented on a change in pull request #11529:
URL: https://github.com/apache/beam/pull/11529#discussion_r428235563



##########
File path: 
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/spanner/SpannerIOWriteTest.java
##########
@@ -263,6 +263,17 @@ private void verifyBatches(Iterable<Mutation>... batches) {
 
   @Test
   public void noBatching() throws Exception {
+
+    // This test uses a different mock/fake because it explicitly does not 
want to populate the
+    // Spanner schema.
+    FakeServiceFactory fakeServiceFactory = new FakeServiceFactory();
+    ReadOnlyTransaction tx = mock(ReadOnlyTransaction.class);
+    
when(fakeServiceFactory.mockDatabaseClient().readOnlyTransaction()).thenReturn(tx);
+
+    // Capture batches sent to writeAtLeastOnce.
+    
when(fakeServiceFactory.mockDatabaseClient().writeAtLeastOnce(mutationBatchesCaptor.capture()))
+        .thenReturn(null);
+

Review comment:
       This test specifically tests that the pipeline stage for reading the 
schema (required for grouping/batching) are not being used, verifying that the 
batching is being bypassed. Yes, this is an implementation detail, but I added 
this part of the test so that future changes do not break this behaviour.
   
   I cannot use the already-created serviceFactory here because that does not 
give me access to the mock ReadOnlyTransaction that I need to verify that 
executeQuery() is never called.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to