Skip to content

Commit

Permalink
docs(samples): fix undeleteTable sample IT failure (#1912)
Browse files Browse the repository at this point in the history
Caused by empty table schema

Fixes #1911
  • Loading branch information
stephaniewang526 authored Mar 9, 2022
1 parent d35d689 commit 7802f16
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import static com.google.common.truth.Truth.assertThat;
import static junit.framework.TestCase.assertNotNull;

import com.google.cloud.bigquery.Field;
import com.google.cloud.bigquery.Schema;
import com.google.cloud.bigquery.StandardSQLTypeName;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.UUID;
Expand Down Expand Up @@ -62,7 +64,11 @@ public void setUp() {
tableName = "UNDELETE_TABLE_TEST_" + UUID.randomUUID().toString().substring(0, 8);
recoverTableName = "RECOVER_DELETE_TABLE_TEST_" + UUID.randomUUID().toString().substring(0, 8);
// Create table in dataset for testing
CreateTable.createTable(BIGQUERY_DATASET_NAME, tableName, Schema.of());
Schema schema =
Schema.of(
Field.of("stringField", StandardSQLTypeName.STRING),
Field.of("booleanField", StandardSQLTypeName.BOOL));
CreateTable.createTable(BIGQUERY_DATASET_NAME, tableName, schema);
}

@After
Expand Down

0 comments on commit 7802f16

Please sign in to comment.