.withBatchSizeBytes(0) .withFailureMode(SpannerIO.FailureMode.REPORT_FAILURES) .grouped()); PAssert.that(result.getFailedMutations()) .satisfies(
@Test @Category(NeedsRunner.class) public void singleMutationGroupPipeline() throws Exception { PCollection<MutationGroup> mutations = pipeline.apply(Create.<MutationGroup>of(g(m(1L), m(2L), m(3L)))); mutations.apply( SpannerIO.write() .withProjectId("test-project") .withInstanceId("test-instance") .withDatabaseId("test-database") .withServiceFactory(serviceFactory) .grouped()); pipeline.run(); verifyBatches(batch(m(1L), m(2L), m(3L))); }
@Test @Category(NeedsRunner.class) public void noBatching() throws Exception { PCollection<MutationGroup> mutations = pipeline.apply(Create.of(g(m(1L)), g(m(2L)))); mutations.apply( SpannerIO.write() .withProjectId("test-project") .withInstanceId("test-instance") .withDatabaseId("test-database") .withServiceFactory(serviceFactory) .withBatchSizeBytes(1) .grouped()); pipeline.run(); verifyBatches(batch(m(1L)), batch(m(2L))); }
.withInstanceId(instanceId) .withDatabaseId(databaseId) .grouped());