xtern commented on a change in pull request #9422:
URL: https://github.com/apache/ignite/pull/9422#discussion_r795627797
##########
File path:
modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
##########
@@ -2044,6 +2048,53 @@ public void testBaselineNodeAttributes() throws
Exception {
}
}
+ /** */
+ @Test
+ public void testSnapshot() throws Exception {
+ cleanPersistenceDir();
+
+ String dfltCacheGrp = "testGroup";
+
+ String testSnap0 = "testSnap0";
+ String testSnap1 = "testSnap1";
+
+ try (IgniteEx ignite = startGrid(getConfiguration()
+ .setCacheConfiguration(new
CacheConfiguration<>(DEFAULT_CACHE_NAME).setGroupName(dfltCacheGrp))
+ .setDataStorageConfiguration(
+ new
DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new
DataRegionConfiguration().setName("pds").setPersistenceEnabled(true)
+ )))
+ ) {
+ ignite.cluster().state(ClusterState.ACTIVE);
+
+ ignite.cache(DEFAULT_CACHE_NAME).put(1, 1);
+
+ ignite.snapshot().createSnapshot(testSnap0).get();
+
+ SystemView<SnapshotView> views =
ignite.context().systemView().view(SNAPSHOT_SYS_VIEW);
+
+ assertEquals(1, views.size());
+
+ SnapshotView view = F.first(views);
+
+ assertEquals(testSnap0, view.snapshotName());
+ assertEquals(toStringSafe(ignite.localNode().consistentId()),
view.nodeId());
+
+ List<?> constIds =
ignite.cluster().nodes().stream().map(ClusterNode::consistentId).collect(Collectors.toList());
+
+ assertEquals(toStringSafe(constIds), view.baselineNodes());
+ assertEquals(toStringSafe(Arrays.asList(dfltCacheGrp,
METASTORAGE_CACHE_NAME)), view.cacheGroups());
+
+ ignite.createCache("testCache");
+
+ ignite.snapshot().createSnapshot(testSnap1).get();
+
+ views = ignite.context().systemView().view(SNAPSHOT_SYS_VIEW);
+
+ assertEquals(2, views.size());
Review comment:
```suggestion
assertEquals(2, views.size());
List<String> exp = Lists.newArrayList(testSnap0, testSnap1);
views.forEach(v -> assertTrue(exp.remove(v.snapshotName())));
assertTrue(exp.isEmpty());
```
--
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]