New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IGNITE-19093: Create standalone MetaStorage implementation for test purposes #1832
Conversation
60ef107
to
d771288
Compare
02f5f02
to
3a95694
Compare
8668d30
to
56faee6
Compare
...tFixtures/java/org/apache/ignite/internal/metastorage/impl/StandaloneMetaStorageManager.java
Outdated
Show resolved
Hide resolved
...tFixtures/java/org/apache/ignite/internal/metastorage/impl/StandaloneMetaStorageManager.java
Outdated
Show resolved
Hide resolved
...tFixtures/java/org/apache/ignite/internal/metastorage/impl/StandaloneMetaStorageManager.java
Outdated
Show resolved
Hide resolved
...tFixtures/java/org/apache/ignite/internal/metastorage/impl/StandaloneMetaStorageManager.java
Outdated
Show resolved
Hide resolved
...tFixtures/java/org/apache/ignite/internal/metastorage/impl/StandaloneMetaStorageManager.java
Outdated
Show resolved
Hide resolved
...pache/ignite/internal/distributionzones/DistributionZoneManagerConfigurationChangesTest.java
Outdated
Show resolved
Hide resolved
...tFixtures/java/org/apache/ignite/internal/metastorage/impl/StandaloneMetaStorageManager.java
Outdated
Show resolved
Hide resolved
...pache/ignite/internal/distributionzones/DistributionZoneManagerConfigurationChangesTest.java
Outdated
Show resolved
Hide resolved
mockVaultZonesLogicalTopologyKey(nodes); | ||
// Mock logical topology for distribution zone. | ||
// vaultMgr.put(zonesLogicalTopologyKey(), toBytes(nodes)); | ||
keyValueStorage.put(zonesLogicalTopologyVersionKey().bytes(), longToBytes(1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the previous approach with mocking LogicalTopologyService
more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems, here is a race, or the test was incorrect from the very beginning.
https://issues.apache.org/jira/browse/IGNITE-19104
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vaultMgr = mock(VaultManager.class);
when(vaultMgr.get(any())).thenReturn(completedFuture(null));
CompletableFuture<VaultEntry> fut = new CompletableFuture<>();;
when(vaultMgr.get(zonesLogicalTopologyKey()))
.thenReturn(fut.completeAsync(
() -> new VaultEntry(zonesLogicalTopologyKey(), toBytes(nodes)),
CompletableFuture.delayedExecutor(1, TimeUnit.SECONDS)));
Test fails if we delay future completion.
That means DistributedZoneManager make some interactions with other components, that are not tested well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reverted to the previous approach.
Looks fine.
https://issues.apache.org/jira/browse/IGNITE-19093