This is an automated email from the ASF dual-hosted git repository. sk0x50 pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push: new 7152f2c7ac IGNITE-22355 TableManagerTest's static mocks from #mockManagersAndCreateTableWithDelay don't work properly (#3843) 7152f2c7ac is described below commit 7152f2c7ac2cf4aa945a3fc0bc6f3e5a619ea9c1 Author: Mikhail Efremov <jakuten...@gmail.com> AuthorDate: Mon Jun 3 14:58:56 2024 +0600 IGNITE-22355 TableManagerTest's static mocks from #mockManagersAndCreateTableWithDelay don't work properly (#3843) --- .../internal/table/distributed/TableManagerTest.java | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java index a99730b527..dcfad44ebc 100644 --- a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java +++ b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java @@ -57,10 +57,9 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.nio.file.Path; -import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.List; +import java.util.Set; import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; @@ -73,7 +72,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.function.Consumer; import java.util.function.LongFunction; -import org.apache.ignite.internal.affinity.AffinityUtils; import org.apache.ignite.internal.affinity.Assignment; import org.apache.ignite.internal.affinity.Assignments; import org.apache.ignite.internal.catalog.CatalogManager; @@ -155,6 +153,7 @@ import org.mockito.junit.jupiter.MockitoSettings; import org.mockito.quality.Strictness; /** Tests scenarios for table manager. */ +// TODO: test demands for reworking https://issues.apache.org/jira/browse/IGNITE-22388 @ExtendWith({MockitoExtension.class, ConfigurationExtension.class}) @MockitoSettings(strictness = Strictness.LENIENT) public class TableManagerTest extends IgniteAbstractTest { @@ -180,6 +179,7 @@ public class TableManagerTest extends IgniteAbstractTest { private static final String ZONE_NAME = "zone1"; /** Topology service. */ + // TODO: useless field for now https://issues.apache.org/jira/browse/IGNITE-22388 @Mock private TopologyService ts; @@ -724,27 +724,21 @@ public class TableManagerTest extends IgniteAbstractTest { return completedFuture(raftGrpSrvcMock); }); + // TODO: useless code https://issues.apache.org/jira/browse/IGNITE-22388 when(ts.getByConsistentId(any())).thenReturn(new ClusterNodeImpl( UUID.randomUUID().toString(), consistentId, new NetworkAddress("localhost", 47500) )); + // TODO: should be removed or reworked https://issues.apache.org/jira/browse/IGNITE-22388 try (MockedStatic<SchemaUtils> schemaServiceMock = mockStatic(SchemaUtils.class)) { schemaServiceMock.when(() -> SchemaUtils.prepareSchemaDescriptor(any())) .thenReturn(mock(SchemaDescriptor.class)); } - try (MockedStatic<AffinityUtils> affinityServiceMock = mockStatic(AffinityUtils.class)) { - ArrayList<List<ClusterNode>> assignment = new ArrayList<>(PARTITIONS); - - for (int part = 0; part < PARTITIONS; part++) { - assignment.add(new ArrayList<>(Collections.singleton(node))); - } - - affinityServiceMock.when(() -> AffinityUtils.calculateAssignments(any(), anyInt(), anyInt())) - .thenReturn(assignment); - } + when(distributionZoneManager.dataNodes(anyLong(), anyInt(), anyInt())) + .thenReturn(completedFuture(Set.of(NODE_NAME))); TableManager tableManager = createTableManager(tblManagerFut);