You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gobblin.apache.org by ap...@apache.org on 2021/08/10 02:11:46 UTC

[gobblin] branch master updated: [GOBBLIN-1511] Fix issue where tests would modify the same table (#3359)

This is an automated email from the ASF dual-hosted git repository.

aplex pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/gobblin.git


The following commit(s) were added to refs/heads/master by this push:
     new 45f70c7  [GOBBLIN-1511] Fix issue where tests would modify the same table (#3359)
45f70c7 is described below

commit 45f70c7c8dee02552d61c77ac7d8e93971de34d5
Author: William Lo <lo...@gmail.com>
AuthorDate: Mon Aug 9 19:11:40 2021 -0700

    [GOBBLIN-1511] Fix issue where tests would modify the same table (#3359)
    
    Adds additional tables to test so that tests can run without interfering with each other. Currently there is a concurrency issue when running HiveSourceTest locally through Intellij.
---
 .../management/conversion/hive/HiveSourceTest.java     | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/gobblin-data-management/src/test/java/org/apache/gobblin/data/management/conversion/hive/HiveSourceTest.java b/gobblin-data-management/src/test/java/org/apache/gobblin/data/management/conversion/hive/HiveSourceTest.java
index e6e4a72..3c85e0b 100644
--- a/gobblin-data-management/src/test/java/org/apache/gobblin/data/management/conversion/hive/HiveSourceTest.java
+++ b/gobblin-data-management/src/test/java/org/apache/gobblin/data/management/conversion/hive/HiveSourceTest.java
@@ -52,6 +52,8 @@ public class HiveSourceTest {
   private static final String TEST_TABLE_1 = "testtable1";
   private static final String TEST_TABLE_2 = "testtable2";
   private static final String TEST_TABLE_3 = "testtable3";
+  private static final String TEST_TABLE_4 = "testtable4";
+  private static final String TEST_TABLE_5 = "testtable5";
 
   private LocalHiveMetastoreTestUtils hiveMetastoreTestUtils;
   private HiveSource hiveSource;
@@ -159,21 +161,21 @@ public class HiveSourceTest {
   @Test
   public void testGetWorkunitsAfterWatermark() throws Exception {
     String dbName = "testdb4";
-    String tableSdLoc1 = new File(this.tmpDir, TEST_TABLE_1).getAbsolutePath();
-    String tableSdLoc2 = new File(this.tmpDir, TEST_TABLE_2).getAbsolutePath();
+    String tableSdLoc1 = new File(this.tmpDir, TEST_TABLE_4).getAbsolutePath();
+    String tableSdLoc2 = new File(this.tmpDir, TEST_TABLE_5).getAbsolutePath();
 
     this.hiveMetastoreTestUtils.getLocalMetastoreClient().dropDatabase(dbName, false, true, true);
 
-    this.hiveMetastoreTestUtils.createTestAvroTable(dbName, TEST_TABLE_1, tableSdLoc1, Optional.<String> absent());
-    this.hiveMetastoreTestUtils.createTestAvroTable(dbName, TEST_TABLE_2, tableSdLoc2, Optional.<String> absent(), true);
+    this.hiveMetastoreTestUtils.createTestAvroTable(dbName, TEST_TABLE_4, tableSdLoc1, Optional.<String> absent());
+    this.hiveMetastoreTestUtils.createTestAvroTable(dbName, TEST_TABLE_5, tableSdLoc2, Optional.<String> absent(), true);
 
     List<WorkUnitState> previousWorkUnitStates = Lists.newArrayList();
 
-    Table table1 = this.hiveMetastoreTestUtils.getLocalMetastoreClient().getTable(dbName, TEST_TABLE_1);
+    Table table1 = this.hiveMetastoreTestUtils.getLocalMetastoreClient().getTable(dbName, TEST_TABLE_4);
 
     // Denote watermark to have a past created timestamp, so that the watermark workunit gets generated
     // This is so that the test is reliable across different operating systems and not flaky to System timing differences
-    previousWorkUnitStates.add(ConversionHiveTestUtils.createWus(dbName, TEST_TABLE_1,
+    previousWorkUnitStates.add(ConversionHiveTestUtils.createWus(dbName, TEST_TABLE_4,
         TimeUnit.MILLISECONDS.convert(table1.getCreateTime(), TimeUnit.SECONDS)-100));
 
     SourceState testState = new SourceState(getTestState(dbName), previousWorkUnitStates);
@@ -187,14 +189,14 @@ public class HiveSourceTest {
     HiveWorkUnit hwu = new HiveWorkUnit(wu);
 
     Assert.assertEquals(hwu.getHiveDataset().getDbAndTable().getDb(), dbName);
-    Assert.assertEquals(hwu.getHiveDataset().getDbAndTable().getTable(), TEST_TABLE_1);
+    Assert.assertEquals(hwu.getHiveDataset().getDbAndTable().getTable(), TEST_TABLE_4);
 
     WorkUnit wu2 = workUnits.get(1);
 
     HiveWorkUnit hwu2 = new HiveWorkUnit(wu2);
 
     Assert.assertEquals(hwu2.getHiveDataset().getDbAndTable().getDb(), dbName);
-    Assert.assertEquals(hwu2.getHiveDataset().getDbAndTable().getTable(), TEST_TABLE_2);
+    Assert.assertEquals(hwu2.getHiveDataset().getDbAndTable().getTable(), TEST_TABLE_5);
   }
 
   @Test