Skip to content

Commit 70b350c

Browse files
committed
Merge pull request #521 from mziccard/fix-template-suffix-test
Wait for table to be created in testInsertAllWithSuffix
2 parents 0fa9b51 + 2d1a368 commit 70b350c

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/ITBigQueryTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ public void testInsertAll() {
476476
}
477477

478478
@Test
479-
public void testInsertAllWithSuffix() {
479+
public void testInsertAllWithSuffix() throws InterruptedException {
480480
String tableName = "test_insert_all_with_suffix_table";
481481
BaseTableInfo tableInfo = TableInfo.of(TableId.of(DATASET, tableName), TABLE_SCHEMA);
482482
assertNotNull(bigquery.create(tableInfo));
@@ -505,7 +505,12 @@ public void testInsertAllWithSuffix() {
505505
assertFalse(response.hasErrors());
506506
assertEquals(0, response.insertErrors().size());
507507
String newTableName = tableName + "_suffix";
508-
assertNotNull(bigquery.getTable(DATASET, newTableName, TableOption.fields()));
508+
BaseTableInfo suffixTable = bigquery.getTable(DATASET, newTableName, TableOption.fields());
509+
while (suffixTable == null) {
510+
Thread.sleep(1000L);
511+
suffixTable = bigquery.getTable(DATASET, newTableName, TableOption.fields());
512+
}
513+
assertNotNull(suffixTable);
509514
assertTrue(bigquery.delete(TableId.of(DATASET, tableName)));
510515
assertTrue(bigquery.delete(TableId.of(DATASET, newTableName)));
511516
}

0 commit comments

Comments
 (0)