Skip to content

Commit

Permalink
docs(samples): Fix flaky test
Browse files Browse the repository at this point in the history
We found that UpdateTableExpirationIT is flaky since during table creation the table is not created.
  • Loading branch information
irvifa committed May 28, 2020
1 parent 117b49e commit e6441cc
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -19,6 +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.concurrent.TimeUnit;
Expand Down Expand Up @@ -59,7 +62,11 @@ public void tearDown() {
@Test
public void updateTableExpiration() {
String tableName = "update_expiration_table";
CreateTable.createTable(BIGQUERY_DATASET_NAME, tableName, null);
Schema schema =
Schema.of(
Field.of("stringField", StandardSQLTypeName.STRING),
Field.of("booleanField", StandardSQLTypeName.BOOL));
CreateTable.createTable(BIGQUERY_DATASET_NAME, tableName, schema);
Long newExpiration = TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS);
UpdateTableExpiration.updateTableExpiration(BIGQUERY_DATASET_NAME, tableName, newExpiration);
assertThat(bout.toString()).contains("Table expiration updated successfully");
Expand Down

0 comments on commit e6441cc

Please sign in to comment.