Skip to content
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

Merged
merged 10 commits into from Mar 23, 2023

Conversation

AMashenkov
Copy link
Member

mockVaultZonesLogicalTopologyKey(nodes);
// Mock logical topology for distribution zone.
// vaultMgr.put(zonesLogicalTopologyKey(), toBytes(nodes));
keyValueStorage.put(zonesLogicalTopologyVersionKey().bytes(), longToBytes(1));
Copy link
Contributor

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

Copy link
Member Author

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

Copy link
Member Author

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.

Copy link
Member Author

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.

@AMashenkov AMashenkov merged commit 25caedf into main Mar 23, 2023
1 check passed
@AMashenkov AMashenkov deleted the ignite-19093 branch March 23, 2023 15:43
lowka pushed a commit to gridgain/apache-ignite-3 that referenced this pull request Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants