Skip to content

Commit 45f2a04

Browse files
committed
Fix tests to use safe character
1 parent c6b92c0 commit 45f2a04

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

core/src/integration-test/java/com/scalar/db/storage/objectstorage/ObjectStorageMultipleClusteringKeyScanIntegrationTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
package com.scalar.db.storage.objectstorage;
22

33
import com.scalar.db.api.DistributedStorageMultipleClusteringKeyScanIntegrationTestBase;
4+
import com.scalar.db.io.Column;
5+
import com.scalar.db.io.DataType;
6+
import com.scalar.db.io.TextColumn;
7+
import com.scalar.db.util.TestUtils;
48
import java.util.Properties;
9+
import java.util.stream.IntStream;
510

611
public class ObjectStorageMultipleClusteringKeyScanIntegrationTest
712
extends DistributedStorageMultipleClusteringKeyScanIntegrationTestBase {
@@ -20,4 +25,15 @@ protected int getThreadNum() {
2025
protected boolean isParallelDdlSupported() {
2126
return false;
2227
}
28+
29+
@Override
30+
protected Column<?> getColumnWithMaxValue(String columnName, DataType dataType) {
31+
if (dataType == DataType.TEXT && ObjectStorageEnv.isCloudStorage()) {
32+
// Since Cloud Storage can't handle 0xFF character correctly, we use "ZZZ..." as the max value
33+
StringBuilder builder = new StringBuilder();
34+
IntStream.range(0, TestUtils.MAX_TEXT_COUNT).forEach(i -> builder.append('Z'));
35+
return TextColumn.of(columnName, builder.toString());
36+
}
37+
return super.getColumnWithMaxValue(columnName, dataType);
38+
}
2339
}

core/src/integration-test/java/com/scalar/db/storage/objectstorage/ObjectStorageMultiplePartitionKeyIntegrationTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
package com.scalar.db.storage.objectstorage;
22

33
import com.scalar.db.api.DistributedStorageMultiplePartitionKeyIntegrationTestBase;
4+
import com.scalar.db.io.Column;
5+
import com.scalar.db.io.DataType;
6+
import com.scalar.db.io.TextColumn;
7+
import com.scalar.db.util.TestUtils;
48
import java.util.Properties;
9+
import java.util.stream.IntStream;
510

611
public class ObjectStorageMultiplePartitionKeyIntegrationTest
712
extends DistributedStorageMultiplePartitionKeyIntegrationTestBase {
@@ -20,4 +25,15 @@ protected int getThreadNum() {
2025
protected boolean isParallelDdlSupported() {
2126
return false;
2227
}
28+
29+
@Override
30+
protected Column<?> getColumnWithMaxValue(String columnName, DataType dataType) {
31+
if (dataType == DataType.TEXT && ObjectStorageEnv.isCloudStorage()) {
32+
// Since Cloud Storage can't handle 0xFF character correctly, we use "ZZZ..." as the max value
33+
StringBuilder builder = new StringBuilder();
34+
IntStream.range(0, TestUtils.MAX_TEXT_COUNT).forEach(i -> builder.append('Z'));
35+
return TextColumn.of(columnName, builder.toString());
36+
}
37+
return super.getColumnWithMaxValue(columnName, dataType);
38+
}
2339
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
11
package com.scalar.db.storage.objectstorage;
22

33
import com.scalar.db.api.DistributedStorageSingleClusteringKeyScanIntegrationTestBase;
4+
import com.scalar.db.io.Column;
5+
import com.scalar.db.io.DataType;
6+
import com.scalar.db.io.TextColumn;
7+
import com.scalar.db.util.TestUtils;
48
import java.util.Properties;
9+
import java.util.stream.IntStream;
510

611
public class ObjectStorageSingleClusteringKeyScanIntegrationTest
712
extends DistributedStorageSingleClusteringKeyScanIntegrationTestBase {
13+
814
@Override
915
protected Properties getProperties(String testName) {
1016
return ObjectStorageEnv.getProperties(testName);
1117
}
18+
19+
@Override
20+
protected Column<?> getColumnWithMaxValue(String columnName, DataType dataType) {
21+
if (dataType == DataType.TEXT && ObjectStorageEnv.isCloudStorage()) {
22+
// Since Cloud Storage can't handle 0xFF character correctly, we use "ZZZ..." as the max value
23+
StringBuilder builder = new StringBuilder();
24+
IntStream.range(0, TestUtils.MAX_TEXT_COUNT).forEach(i -> builder.append('Z'));
25+
return TextColumn.of(columnName, builder.toString());
26+
}
27+
return super.getColumnWithMaxValue(columnName, dataType);
28+
}
1229
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
11
package com.scalar.db.storage.objectstorage;
22

33
import com.scalar.db.api.DistributedStorageSinglePartitionKeyIntegrationTestBase;
4+
import com.scalar.db.io.Column;
5+
import com.scalar.db.io.DataType;
6+
import com.scalar.db.io.TextColumn;
7+
import com.scalar.db.util.TestUtils;
48
import java.util.Properties;
9+
import java.util.stream.IntStream;
510

611
public class ObjectStorageSinglePartitionKeyIntegrationTest
712
extends DistributedStorageSinglePartitionKeyIntegrationTestBase {
13+
814
@Override
915
protected Properties getProperties(String testName) {
1016
return ObjectStorageEnv.getProperties(testName);
1117
}
18+
19+
@Override
20+
protected Column<?> getColumnWithMaxValue(String columnName, DataType dataType) {
21+
if (dataType == DataType.TEXT && ObjectStorageEnv.isCloudStorage()) {
22+
// Since Cloud Storage can't handle 0xFF character correctly, we use "ZZZ..." as the max value
23+
StringBuilder builder = new StringBuilder();
24+
IntStream.range(0, TestUtils.MAX_TEXT_COUNT).forEach(i -> builder.append('Z'));
25+
return TextColumn.of(columnName, builder.toString());
26+
}
27+
return super.getColumnWithMaxValue(columnName, dataType);
28+
}
1229
}

0 commit comments

Comments
 (0)