Skip to content

Commit 8f42e36

Browse files
committed
chore: Add unique id to each table
1 parent efa8185 commit 8f42e36

File tree

1 file changed

+42
-24
lines changed

1 file changed

+42
-24
lines changed

google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5733,8 +5733,10 @@ void testListJobsWithCreationBounding() {
57335733

57345734
@Test
57355735
void testCreateAndGetJob() throws InterruptedException, TimeoutException {
5736-
String sourceTableName = "test_create_and_get_job_source_table";
5737-
String destinationTableName = "test_create_and_get_job_destination_table";
5736+
String sourceTableName =
5737+
"test_create_and_get_job_source_table" + UUID.randomUUID().toString().substring(0, 8);
5738+
String destinationTableName =
5739+
"test_create_and_get_job_destination_table" + UUID.randomUUID().toString().substring(0, 8);
57385740
TableId sourceTable = TableId.of(DATASET, sourceTableName);
57395741
StandardTableDefinition tableDefinition = StandardTableDefinition.of(TABLE_SCHEMA);
57405742
TableInfo tableInfo = TableInfo.of(sourceTable, tableDefinition);
@@ -5791,8 +5793,12 @@ void testCreateJobAndWaitForWithRetryOptions() throws InterruptedException, Time
57915793

57925794
@Test
57935795
void testCreateAndGetJobWithSelectedFields() throws InterruptedException, TimeoutException {
5794-
String sourceTableName = "test_create_and_get_job_with_selected_fields_source_table";
5795-
String destinationTableName = "test_create_and_get_job_with_selected_fields_destination_table";
5796+
String sourceTableName =
5797+
"test_create_and_get_job_with_selected_fields_source_table"
5798+
+ UUID.randomUUID().toString().substring(0, 8);
5799+
String destinationTableName =
5800+
"test_create_and_get_job_with_selected_fields_destination_table"
5801+
+ UUID.randomUUID().toString().substring(0, 8);
57965802
TableId sourceTable = TableId.of(DATASET, sourceTableName);
57975803
StandardTableDefinition tableDefinition = StandardTableDefinition.of(TABLE_SCHEMA);
57985804
TableInfo tableInfo = TableInfo.of(sourceTable, tableDefinition);
@@ -5839,8 +5845,10 @@ void testCreateAndGetJobWithSelectedFields() throws InterruptedException, Timeou
58395845

58405846
@Test
58415847
void testCopyJob() throws InterruptedException, TimeoutException {
5842-
String sourceTableName = "test_copy_job_source_table";
5843-
String destinationTableName = "test_copy_job_destination_table";
5848+
String sourceTableName =
5849+
"test_copy_job_source_table" + UUID.randomUUID().toString().substring(0, 8);
5850+
String destinationTableName =
5851+
"test_copy_job_destination_table" + UUID.randomUUID().toString().substring(0, 8);
58445852
TableId sourceTable = TableId.of(DATASET, sourceTableName);
58455853
StandardTableDefinition tableDefinition = StandardTableDefinition.of(TABLE_SCHEMA);
58465854
TableInfo tableInfo = TableInfo.of(sourceTable, tableDefinition);
@@ -5871,8 +5879,10 @@ void testCopyJob() throws InterruptedException, TimeoutException {
58715879

58725880
@Test
58735881
void testCopyJobStatistics() throws InterruptedException, TimeoutException {
5874-
String sourceTableName = "test_copy_job_statistics_source_table";
5875-
String destinationTableName = "test_copy_job_statistics_destination_table";
5882+
String sourceTableName =
5883+
"test_copy_job_statistics_source_table" + UUID.randomUUID().toString().substring(0, 8);
5884+
String destinationTableName =
5885+
"test_copy_job_statistics_destination_table" + UUID.randomUUID().toString().substring(0, 8);
58765886

58775887
QueryJobConfiguration createTable =
58785888
QueryJobConfiguration.newBuilder(
@@ -6013,7 +6023,7 @@ void testCopyJobWithLabelsAndExpTime() throws InterruptedException {
60136023
/* TODO(prasmish): replicate the entire test case for executeSelect */
60146024
@Test
60156025
public void testQueryJob() throws InterruptedException, TimeoutException {
6016-
String tableName = "test_query_job_table";
6026+
String tableName = "test_query_job_table" + UUID.randomUUID().toString().substring(0, 8);
60176027
String query = "SELECT TimestampField, StringField, BooleanField FROM " + TABLE_ID.getTable();
60186028
TableId destinationTable = TableId.of(DATASET, tableName);
60196029
QueryJobConfiguration configuration =
@@ -6059,7 +6069,8 @@ public void testQueryJob() throws InterruptedException, TimeoutException {
60596069
/* TODO(prasmish): replicate the entire test case for executeSelect */
60606070
@Test
60616071
void testQueryJobWithConnectionProperties() throws InterruptedException {
6062-
String tableName = "test_query_job_table_connection_properties";
6072+
String tableName =
6073+
"test_query_job_table_connection_properties" + UUID.randomUUID().toString().substring(0, 8);
60636074
String query = "SELECT TimestampField, StringField, BooleanField FROM " + TABLE_ID.getTable();
60646075
TableId destinationTable = TableId.of(DATASET, tableName);
60656076
QueryJobConfiguration configuration =
@@ -6079,7 +6090,7 @@ void testQueryJobWithConnectionProperties() throws InterruptedException {
60796090
/* TODO(prasmish): replicate the entire test case for executeSelect */
60806091
@Test
60816092
void testQueryJobWithLabels() throws InterruptedException, TimeoutException {
6082-
String tableName = "test_query_job_table";
6093+
String tableName = "test_query_job_table" + UUID.randomUUID().toString().substring(0, 8);
60836094
String query = "SELECT TimestampField, StringField, BooleanField FROM " + TABLE_ID.getTable();
60846095
Map<String, String> labels = ImmutableMap.of("test-job-name", "test-query-job");
60856096
TableId destinationTable = TableId.of(DATASET, tableName);
@@ -6102,11 +6113,9 @@ void testQueryJobWithLabels() throws InterruptedException, TimeoutException {
61026113

61036114
@Test
61046115
void testQueryJobWithSearchReturnsSearchStatisticsUnused() throws InterruptedException {
6105-
String tableName = "test_query_job_table";
6116+
String tableName = "test_query_job_table" + UUID.randomUUID().toString().substring(0, 8);
61066117
String query =
6107-
"SELECT * FROM "
6108-
+ TABLE_ID.getTable()
6109-
+ " WHERE search(StringField, \"stringValue\")";
6118+
"SELECT * FROM " + TABLE_ID.getTable() + " WHERE search(StringField, \"stringValue\")";
61106119
TableId destinationTable = TableId.of(DATASET, tableName);
61116120
try {
61126121
QueryJobConfiguration configuration =
@@ -6132,7 +6141,8 @@ void testQueryJobWithSearchReturnsSearchStatisticsUnused() throws InterruptedExc
61326141
/* TODO(prasmish): replicate the entire test case for executeSelect */
61336142
@Test
61346143
void testQueryJobWithRangePartitioning() throws InterruptedException {
6135-
String tableName = "test_query_job_table_rangepartitioning";
6144+
String tableName =
6145+
"test_query_job_table_rangepartitioning" + UUID.randomUUID().toString().substring(0, 8);
61366146
String query =
61376147
"SELECT IntegerField, TimestampField, StringField, BooleanField FROM "
61386148
+ TABLE_ID.getTable();
@@ -6157,7 +6167,8 @@ void testQueryJobWithRangePartitioning() throws InterruptedException {
61576167

61586168
@Test
61596169
void testLoadJobWithRangePartitioning() throws InterruptedException {
6160-
String tableName = "test_load_job_table_rangepartitioning";
6170+
String tableName =
6171+
"test_load_job_table_rangepartitioning" + UUID.randomUUID().toString().substring(0, 8);
61616172
TableId destinationTable = TableId.of(DATASET, tableName);
61626173
try {
61636174
LoadJobConfiguration configuration =
@@ -6181,7 +6192,9 @@ void testLoadJobWithRangePartitioning() throws InterruptedException {
61816192

61826193
@Test
61836194
void testLoadJobWithDecimalTargetTypes() throws InterruptedException {
6184-
String tableName = "test_load_job_table_parquet_decimalTargetTypes";
6195+
String tableName =
6196+
"test_load_job_table_parquet_decimalTargetTypes"
6197+
+ UUID.randomUUID().toString().substring(0, 8);
61856198
TableId destinationTable = TableId.of(DATASET, tableName);
61866199
String sourceUri = "gs://" + CLOUD_SAMPLES_DATA + "/bigquery/numeric/numeric_38_12.parquet";
61876200
try {
@@ -6209,7 +6222,9 @@ void testLoadJobWithDecimalTargetTypes() throws InterruptedException {
62096222

62106223
@Test
62116224
void testExternalTableWithDecimalTargetTypes() throws InterruptedException {
6212-
String tableName = "test_create_external_table_parquet_decimalTargetTypes";
6225+
String tableName =
6226+
"test_create_external_table_parquet_decimalTargetTypes"
6227+
+ UUID.randomUUID().toString().substring(0, 8);
62136228
TableId destinationTable = TableId.of(DATASET, tableName);
62146229
String sourceUri = "gs://" + CLOUD_SAMPLES_DATA + "/bigquery/numeric/numeric_38_12.parquet";
62156230
ExternalTableDefinition externalTableDefinition =
@@ -6229,7 +6244,7 @@ void testExternalTableWithDecimalTargetTypes() throws InterruptedException {
62296244

62306245
@Test
62316246
void testQueryJobWithDryRun() throws InterruptedException, TimeoutException {
6232-
String tableName = "test_query_job_table";
6247+
String tableName = "test_query_job_table" + UUID.randomUUID().toString().substring(0, 8);
62336248
String query = "SELECT TimestampField, StringField, BooleanField FROM " + TABLE_ID.getTable();
62346249
TableId destinationTable = TableId.of(DATASET, tableName);
62356250
QueryJobConfiguration configuration =
@@ -6247,7 +6262,7 @@ void testQueryJobWithDryRun() throws InterruptedException, TimeoutException {
62476262

62486263
@Test
62496264
void testExtractJob() throws InterruptedException, TimeoutException {
6250-
String tableName = "test_export_job_table";
6265+
String tableName = "test_export_job_table" + UUID.randomUUID().toString().substring(0, 8);
62516266
TableId destinationTable = TableId.of(DATASET, tableName);
62526267
Map<String, String> labels = ImmutableMap.of("test-job-name", "test-load-extract-job");
62536268
LoadJobConfiguration configuration =
@@ -6324,7 +6339,7 @@ void testExtractJobWithModel() throws InterruptedException {
63246339

63256340
@Test
63266341
void testExtractJobWithLabels() throws InterruptedException, TimeoutException {
6327-
String tableName = "test_export_job_table_label";
6342+
String tableName = "test_export_job_table_label" + UUID.randomUUID().toString().substring(0, 8);
63286343
Map<String, String> labels = ImmutableMap.of("test_job_name", "test_export_job");
63296344
TableId destinationTable = TableId.of(DATASET, tableName);
63306345
LoadJobConfiguration configuration =
@@ -6350,7 +6365,8 @@ void testExtractJobWithLabels() throws InterruptedException, TimeoutException {
63506365

63516366
@Test
63526367
void testCancelJob() throws InterruptedException, TimeoutException {
6353-
String destinationTableName = "test_cancel_query_job_table";
6368+
String destinationTableName =
6369+
"test_cancel_query_job_table" + UUID.randomUUID().toString().substring(0, 8);
63546370
String query = "SELECT TimestampField, StringField, BooleanField FROM " + TABLE_ID.getTable();
63556371
TableId destinationTable = TableId.of(DATASET, destinationTableName);
63566372
QueryJobConfiguration configuration =
@@ -6632,7 +6648,9 @@ void testWriteChannelPreserveAsciiControlCharacters()
66326648

66336649
@Test
66346650
void testLoadJobPreserveAsciiControlCharacters() throws InterruptedException {
6635-
String destinationTableName = "test_load_job_preserve_ascii_control_characters";
6651+
String destinationTableName =
6652+
"test_load_job_preserve_ascii_control_characters"
6653+
+ UUID.randomUUID().toString().substring(0, 8);
66366654
TableId destinationTable = TableId.of(DATASET, destinationTableName);
66376655

66386656
try {

0 commit comments

Comments
 (0)