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

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


The following commit(s) were added to refs/heads/master by this push:
     new 196b42ba2a [Flaky-test] Fix TableCacheTest (#11717)
196b42ba2a is described below

commit 196b42ba2ae935b575c0d83e77cdde0a0f360f19
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Mon Oct 2 11:48:54 2023 -0700

    [Flaky-test] Fix TableCacheTest (#11717)
---
 .../java/org/apache/pinot/controller/helix/ControllerTest.java    | 5 +++++
 .../java/org/apache/pinot/controller/helix/TableCacheTest.java    | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git 
a/pinot-controller/src/test/java/org/apache/pinot/controller/helix/ControllerTest.java
 
b/pinot-controller/src/test/java/org/apache/pinot/controller/helix/ControllerTest.java
index ef097e99ae..43b7e4224e 100644
--- 
a/pinot-controller/src/test/java/org/apache/pinot/controller/helix/ControllerTest.java
+++ 
b/pinot-controller/src/test/java/org/apache/pinot/controller/helix/ControllerTest.java
@@ -680,6 +680,11 @@ public class ControllerTest {
     
getControllerRequestClient().deleteTable(TableNameBuilder.REALTIME.tableNameWithType(tableName));
   }
 
+  public void waitForEVToAppear(String tableNameWithType) {
+    TestUtils.waitForCondition(aVoid -> 
_helixResourceManager.getTableExternalView(tableNameWithType) != null, 60_000L,
+        "Failed to create the external view for table: " + tableNameWithType);
+  }
+
   public void waitForEVToDisappear(String tableNameWithType) {
     TestUtils.waitForCondition(aVoid -> 
_helixResourceManager.getTableExternalView(tableNameWithType) == null, 60_000L,
         "Failed to clean up the external view for table: " + 
tableNameWithType);
diff --git 
a/pinot-controller/src/test/java/org/apache/pinot/controller/helix/TableCacheTest.java
 
b/pinot-controller/src/test/java/org/apache/pinot/controller/helix/TableCacheTest.java
index 17880643e0..fff0ac890e 100644
--- 
a/pinot-controller/src/test/java/org/apache/pinot/controller/helix/TableCacheTest.java
+++ 
b/pinot-controller/src/test/java/org/apache/pinot/controller/helix/TableCacheTest.java
@@ -98,7 +98,6 @@ public class TableCacheTest {
     // Add a table config
     TableConfig tableConfig =
         new 
TableConfigBuilder(TableType.OFFLINE).setTableName(RAW_TABLE_NAME).setSchemaName(SCHEMA_NAME).build();
-    TEST_INSTANCE.waitForEVToDisappear(tableConfig.getTableName());
     TEST_INSTANCE.getHelixResourceManager().addTable(tableConfig);
     // Wait for at most 10 seconds for the callback to add the table config to 
the cache
     TestUtils.waitForCondition(
@@ -181,6 +180,10 @@ public class TableCacheTest {
     assertEquals(tableCache.getSchema(SCHEMA_NAME), expectedSchema);
     assertEquals(tableCache.getColumnNameMap(SCHEMA_NAME), expectedColumnMap);
 
+    // Wait for external view to appear before deleting the table to prevent 
external view being created after the
+    // waitForEVToDisappear() call
+    TEST_INSTANCE.waitForEVToAppear(OFFLINE_TABLE_NAME);
+
     // Remove the table config
     TEST_INSTANCE.getHelixResourceManager().deleteOfflineTable(RAW_TABLE_NAME);
     // Wait for at most 10 seconds for the callback to remove the table config 
from the cache
@@ -210,6 +213,9 @@ public class TableCacheTest {
     assertNull(tableCache.getColumnNameMap(RAW_TABLE_NAME));
     assertEquals(schemaChangeListener._schemaList.size(), 0);
     assertEquals(tableConfigChangeListener._tableConfigList.size(), 0);
+
+    // Wait for external view to disappear to ensure a clean start for the 
next test
+    TEST_INSTANCE.waitForEVToDisappear(OFFLINE_TABLE_NAME);
   }
 
   @DataProvider(name = "testTableCacheDataProvider")


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to