Skip to content

Commit

Permalink
Fix test issues in CopyDbtest.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 338107901
  • Loading branch information
cloud-teleport committed Oct 20, 2020
1 parent 2794dc5 commit 38eb32f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ public void checkConstraints() throws Exception {
runTest();
}

@Test
public void randomSchema() throws Exception {
Ddl ddl = RandomDdlGenerator.builder().build().generate();
createAndPopulate(ddl, 100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/** Facilitates setup and deletion of a Spanner database for integration tests. */
public class SpannerServerResource extends ExternalResource {
// Modify the following parameters to match your Cloud Spanner instance.
private final String projectId = "test-project";
private final String projectId = "span-cloud-testing";
private final String instanceId = "test-instance";
private final String host = "https://spanner.googleapis.com";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static Builder builder() {
.setRandom(new Random())
.setArrayChance(20)
.setMaxPkComponents(3)
.setMaxBranchPerLevel(new int[] {3, 2, 1, 1, 1, 1, 1})
.setMaxBranchPerLevel(new int[] {2, 2, 1, 1, 1, 1, 1})
.setMaxIndex(2)
.setMaxForeignKeys(2)
// TODO: enable once CHECK constraints are enabled
Expand Down Expand Up @@ -186,7 +186,10 @@ private void generateTable(Ddl.Builder builder, Table parent, int level) {
IndexColumn.IndexColumnsBuilder<Index.Builder> columns = index.columns();
boolean interleaved = rnd.nextBoolean();
Set<String> pks = Sets.newHashSet();
if (interleaved) {
// Do not interleave indexes at the last table level.
// This causes tests to fail as generated schema exceeds interleaving limit.
int finalLevel = getMaxBranchPerLevel().length - 1;
if (interleaved && level < finalLevel) {
index.interleaveIn(table.name());
}
for (IndexColumn pk : table.primaryKeys()) {
Expand Down

0 comments on commit 38eb32f

Please sign in to comment.