You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by am...@apache.org on 2024/02/15 16:27:44 UTC

(ignite-3) 03/03: Add test

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

amashenkov pushed a commit to branch ignite-21535
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit e64ca459ab83fe36d99890f072eb581450c9c0a2
Author: amashenkov <an...@gmail.com>
AuthorDate: Thu Feb 15 19:27:32 2024 +0300

    Add test
---
 .../ignite/internal/index/IndexManagerTest.java    | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/modules/index/src/test/java/org/apache/ignite/internal/index/IndexManagerTest.java b/modules/index/src/test/java/org/apache/ignite/internal/index/IndexManagerTest.java
index 6633a11807..d7aeb7ed23 100644
--- a/modules/index/src/test/java/org/apache/ignite/internal/index/IndexManagerTest.java
+++ b/modules/index/src/test/java/org/apache/ignite/internal/index/IndexManagerTest.java
@@ -100,6 +100,7 @@ import org.apache.ignite.sql.IgniteSql;
 import org.jetbrains.annotations.Nullable;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.ArgumentCaptor;
@@ -219,6 +220,43 @@ public class IndexManagerTest extends BaseIgniteAbstractTest {
         verify(tableViewInternal, never()).unregisterIndex(anyInt());
     }
 
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-17626")
+    @Test
+    void testDestroyIndex() throws Exception {
+        createIndex(TABLE_NAME, INDEX_NAME);
+
+        CatalogIndexDescriptor indexDescriptor = catalogManager.index(INDEX_NAME, catalogManager.latestCatalogVersion());
+        int indexId = indexDescriptor.id();
+        int tableId = indexDescriptor.tableId();
+
+        dropIndex(INDEX_NAME);
+        CatalogTestUtils.waitCatalogCompaction(catalogManager, Long.MAX_VALUE);
+
+        long causalityToken = 0L; // Use last token.
+        MvTableStorage mvTableStorage = indexManager.getMvTableStorage(causalityToken, tableId).get();
+
+        verify(mvTableStorage).destroyIndex(indexId);
+    }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-17626")
+    @Test
+    void testIndexDestroyedWithTable() throws Exception {
+        createIndex(TABLE_NAME, INDEX_NAME);
+
+        CatalogIndexDescriptor indexDescriptor = catalogManager.index(INDEX_NAME, catalogManager.latestCatalogVersion());
+        int indexId = indexDescriptor.id();
+        int tableId = indexDescriptor.tableId();
+
+        dropTable(TABLE_NAME);
+        CatalogTestUtils.waitCatalogCompaction(catalogManager, Long.MAX_VALUE);
+
+        long causalityToken = 0L; // Use last token.
+        MvTableStorage mvTableStorage = indexManager.getMvTableStorage(causalityToken, tableId).get();
+
+        verify(mvTableStorage).destroyIndex(indexId);
+    }
+
+
     @Test
     void testCollectIndexesForRecoveryForCreatedTables() {
         createTable(OTHER_TABLE_NAME);