alievmirza commented on code in PR #1426:
URL: https://github.com/apache/ignite-3/pull/1426#discussion_r1054811350
##########
modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/DistributionZoneManagerConfigurationChangesTest.java:
##########
@@ -328,44 +306,40 @@ void testTriggerKeyNotPropagatedAfterZoneUpdate() throws
Exception {
assertZonesChangeTriggerKey(100);
- assertDataNodesForZone(1, clusterNodes);
+ assertDataNodesForZone(1, nodes);
}
@Test
void testZoneDeleteDoNotRemoveMetaStorageKey() throws Exception {
- Set<ClusterNode> clusterNodes = Set.of(new ClusterNode("1", "name1",
null));
-
- mockCmgLocalNodes(clusterNodes);
-
- distributionZoneManager.createZone(new
DistributionZoneConfigurationParameters.Builder(ZONE_NAME).build());
+ distributionZoneManager.createZone(new
DistributionZoneConfigurationParameters.Builder(ZONE_NAME).build()).get();
- assertDataNodesForZone(1, clusterNodes);
+ assertDataNodesForZone(1, nodes);
- keyValueStorage.put(zonesChangeTriggerKey().bytes(),
ByteUtils.longToBytes(100));
+ keyValueStorage.put(zonesChangeTriggerKey().bytes(), longToBytes(100));
- distributionZoneManager.dropZone(ZONE_NAME);
+ distributionZoneManager.dropZone(ZONE_NAME).get();
verify(keyValueStorage, timeout(1000).times(2)).invoke(any());
- assertDataNodesForZone(1, clusterNodes);
+ assertDataNodesForZone(1, nodes);
}
- private LogicalTopologySnapshot mockCmgLocalNodes(Set<ClusterNode>
clusterNodes) {
- LogicalTopologySnapshot logicalTopologySnapshot =
mock(LogicalTopologySnapshot.class);
-
-
when(cmgManager.logicalTopology()).thenReturn(completedFuture(logicalTopologySnapshot));
-
- when(logicalTopologySnapshot.nodes()).thenReturn(clusterNodes);
+ private void mockVaultZonesLogicalTopologyKey(Set<String> nodes) {
+ byte[] newLogicalTopology = toBytes(nodes);
- return logicalTopologySnapshot;
+ when(vaultMgr.get(zonesLogicalTopologyKey()))
+ .thenReturn(completedFuture(new
VaultEntry(zonesLogicalTopologyKey(), newLogicalTopology)));
}
- private void assertDataNodesForZone(int zoneId, @Nullable Set<ClusterNode>
clusterNodes) throws InterruptedException {
- byte[] nodes = clusterNodes == null
- ? null
- :
ByteUtils.toBytes(clusterNodes.stream().map(ClusterNode::name).collect(Collectors.toSet()));
+ private void assertDataNodesForZone(int zoneId, @Nullable Set<String>
expectedNodes) throws InterruptedException {
Review Comment:
Why did you decide to change that method? It is possible that changes will
be propagated with some delay, lets keep it as it was.
```
private void assertDataNodesForZone(int zoneId, @Nullable Set<String>
clusterNodes) throws InterruptedException {
byte[] nodes = clusterNodes == null ? null : toBytes(clusterNodes);
assertTrue(waitForCondition(() ->
Arrays.equals(keyValueStorage.get(zoneDataNodesKey(zoneId).bytes()).value(),
nodes), 1000));
}
```
--
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]