Skip to content

Commit

Permalink
Add test for BigtableSource#split(0, ...)
Browse files Browse the repository at this point in the history
  • Loading branch information
joar committed Oct 5, 2023
1 parent 2665d01 commit 3096265
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,39 @@ public void testReadingWithSplits() throws Exception {
assertSourcesEqualReferenceSource(source, splits, null /* options */);
}

/**
* Regression test for <a href="https://github.com/apache/beam/issues/28793">[Bug]: BigtableSource
* "Desired bundle size 0 bytes must be greater than 0" #28793 </a>.
*/
@Test
public void testSplittingWithDesiredBundleSizeZero() throws Exception {
final String table = "TEST-SPLIT-DESIRED-BUNDLE-SIZE-ZERO-TABLE";
final int numRows = 10;
final int numSamples = 10;
final long bytesPerRow = 1L;

// Set up test table data and sample row keys for size estimation and splitting.
makeTableData(table, numRows);
service.setupSampleRowKeys(table, numSamples, bytesPerRow);

// Generate source and split it.
BigtableSource source =
new BigtableSource(
factory,
configId,
config,
BigtableReadOptions.builder()
.setTableId(StaticValueProvider.of(table))
.setKeyRanges(ALL_KEY_RANGE)
.build(),
null /*size*/);
List<BigtableSource> splits = source.split(0, null /* options */);

// Test num splits and split equality.
assertThat(splits, hasSize(numSamples));
assertSourcesEqualReferenceSource(source, splits, null /* options */);
}

@Test
public void testReadingWithSplitFailed() throws Exception {
FailureBigtableService failureService =
Expand Down

0 comments on commit 3096265

Please sign in to comment.