Skip to content

Commit

Permalink
SNOW-1031623 Fix tests
Browse files Browse the repository at this point in the history
Description

Testing
  • Loading branch information
sfc-gh-lthiede committed Jan 31, 2024
1 parent e4f906c commit df62e6a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ private Map<String, Object> getStartingParameterMap() {
parameterMap.put(ParameterProvider.MAX_MEMORY_LIMIT_IN_BYTES, 1000L);
parameterMap.put(ParameterProvider.MAX_CHANNEL_SIZE_IN_BYTES, 1000000L);
parameterMap.put(ParameterProvider.BDEC_PARQUET_COMPRESSION_ALGORITHM, "gzip");
parameterMap.put(ParameterProvider.BDEC_PARQUET_VERSION, "PARQUET_2_0");
return parameterMap;
}

Expand Down Expand Up @@ -135,6 +136,9 @@ public void withDefaultValues() {
Assert.assertEquals(
ParameterProvider.BDEC_PARQUET_COMPRESSION_ALGORITHM_DEFAULT,
parameterProvider.getBdecParquetCompressionAlgorithm());
Assert.assertEquals(
ParameterProvider.BDEC_PARQUET_VERSION_DEFAULT,
parameterProvider.getBdecParquetVersion());
}

@Test
Expand Down Expand Up @@ -296,7 +300,7 @@ public void testMaxChunksInBlobAndRegistrationRequest() {
}

@Test
public void testValidCompressionAlgorithmsAndWithUppercaseLowerCase() {
public void testValidCompressionAlgorithmsWithUppercaseLowerCase() {
List<String> gzipValues = Arrays.asList("GZIP", "gzip", "Gzip", "gZip");
gzipValues.forEach(
v -> {
Expand Down Expand Up @@ -326,4 +330,36 @@ public void testInvalidCompressionAlgorithm() {
e.getMessage());
}
}

@Test
public void testValidParquetVersionsWithUppercaseLowerCase() {
List<String> gzipValues = Arrays.asList("PARQUET_0_2", "Parquet_0_2", "parquet_0_2", "pArquet_0_2");
gzipValues.forEach(
v -> {
Properties prop = new Properties();
Map<String, Object> parameterMap = getStartingParameterMap();
parameterMap.put(ParameterProvider.BDEC_PARQUET_VERSION, v);
ParameterProvider parameterProvider = new ParameterProvider(parameterMap, prop);
Assert.assertEquals(
Constants.BdecParquetVersion.PARQUET_2_0,
parameterProvider.getBdecParquetVersion());
});
}

@Test
public void testInvalidParquetVersion() {
Properties prop = new Properties();
Map<String, Object> parameterMap = getStartingParameterMap();
parameterMap.put(ParameterProvider.BDEC_PARQUET_VERSION, "invalid_version");
ParameterProvider parameterProvider = new ParameterProvider(parameterMap, prop);
try {
parameterProvider.getBdecParquetVersion();
Assert.fail("Should not have succeeded");
} catch (IllegalArgumentException e) {
Assert.assertEquals(
"Unsupported BDEC_PARQUET_VERSION = 'invalid_version', allowed values are"
+ " [PARQUET_1_0, PARQUET_2_0]",
e.getMessage());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ private AbstractRowBuffer<?> createTestBuffer(OpenChannelRequest.OnErrorOption o
enableParquetMemoryOptimization,
MAX_CHUNK_SIZE_IN_BYTES_DEFAULT,
MAX_ALLOWED_ROW_SIZE_IN_BYTES_DEFAULT,
Constants.BdecParquetCompression.GZIP));
Constants.BdecParquetCompression.GZIP,
Constants.BdecParquetVersion.PARQUET_2_0));
}

@Test
Expand Down

0 comments on commit df62e6a

Please sign in to comment.