ivanzlenko commented on code in PR #6692:
URL: https://github.com/apache/ignite-3/pull/6692#discussion_r2405852806


##########
modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/engine/PersistentPageMemoryStorageEngineTest.java:
##########
@@ -98,4 +108,34 @@ void dataRegionSizeUsedWhenSet(
     protected void persistTableDestructionIfNeeded() {
         // No-op as table destruction is durable for this engine.
     }
+
+    @Test
+    @Override
+    protected void tableMetrics() {
+        var engine = (PersistentPageMemoryStorageEngine) storageEngine;
+
+        var tableDescriptor = new StorageTableDescriptor(10, 1, 
CatalogService.DEFAULT_STORAGE_PROFILE);
+        MvTableStorage table = engine.createMvTable(tableDescriptor, indexId 
-> null);
+
+        List<Metric> metricsList = new ArrayList<>();
+        engine.addTableMetrics(tableDescriptor, metricsList::add);
+
+        assertThat(metricsList.size(), is(1));
+
+        Metric metric = metricsList.get(0);
+        assertThat(metric.name(), is("TotalAllocatedSize"));
+        assertThat(metric, is(instanceOf(LongMetric.class)));
+
+        LongMetric totalAllocatedSize = (LongMetric) metric;
+        assertEquals(0, totalAllocatedSize.value());
+
+        var otherTableDescriptor = new StorageTableDescriptor(20, 1, 
CatalogService.DEFAULT_STORAGE_PROFILE);
+        MvTableStorage otherTable = engine.createMvTable(otherTableDescriptor, 
indexId -> null);
+
+        otherTable.createMvPartition(0);
+        assertEquals(0, totalAllocatedSize.value());
+
+        table.createMvPartition(0);
+        assertThat(totalAllocatedSize.value(), is(greaterThan(0L)));

Review Comment:
   To verify that metric calculated correctly



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to