-
Notifications
You must be signed in to change notification settings - Fork 53
CASSSIDECAR-411: RangeManager should be singleton in CDCModule #323
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
Merged
+79
−59
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
72eeab4
CASSSIDECAR-411: Rangemanager should be singleton in CDCModule
jyothsnakonisa 75f8ae6
checkstyle
jyothsnakonisa cf5ef40
Fixing tests
jyothsnakonisa 0231585
fixing tests
jyothsnakonisa faa77ce
updating guice bindings
jyothsnakonisa fdfd925
changes.txt
jyothsnakonisa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,46 +92,46 @@ public String reverseResolve(String s) | |
| } | ||
| }; | ||
| Set<Host> allHosts = Set.of( | ||
| mockHost("local1", "127.0.0.1", "-9223372036854775808", "DC1"), | ||
| mockHost("local2", "127.0.0.2", "-8301034833169298228", "DC1"), | ||
| mockHost("local3", "127.0.0.3", "-7378697629483820647", "DC1"), | ||
| mockHost("local4", "127.0.0.4", "-6456360425798343066", "DC1"), | ||
| mockHost("local5", "127.0.0.5", "-5534023222112865485", "DC1"), | ||
| mockHost("local6", "127.0.0.6", "-4611686018427387904", "DC1"), | ||
| mockHost("local7", "127.0.0.7", "-3689348814741910324", "DC1"), | ||
| mockHost("local8", "127.0.0.8", "-2767011611056432743", "DC1"), | ||
| mockHost("local9", "127.0.0.9", "-1844674407370955162", "DC1"), | ||
| mockHost("local10", "127.0.0.10", "-922337203685477581", "DC1"), | ||
| mockHost("local11", "127.0.0.11", "0", "DC1"), | ||
| mockHost("local12", "127.0.0.12", "922337203685477580", "DC1"), | ||
| mockHost("local13", "127.0.0.13", "1844674407370955161", "DC1"), | ||
| mockHost("local14", "127.0.0.14", "2767011611056432742", "DC1"), | ||
| mockHost("local15", "127.0.0.15", "3689348814741910323", "DC1"), | ||
| mockHost("local16", "127.0.0.16", "4611686018427387904", "DC1"), | ||
| mockHost("local17", "127.0.0.17", "5534023222112865484", "DC1"), | ||
| mockHost("local18", "127.0.0.18", "6456360425798343065", "DC1"), | ||
| mockHost("local19", "127.0.0.19", "7378697629483820646", "DC1"), | ||
| mockHost("local20", "127.0.0.20", "8301034833169298227", "DC1"), | ||
| mockHost("local21", "127.0.0.21", "-9223372036854775807", "DC2"), | ||
| mockHost("local22", "127.0.0.22", "-8301034833169298227", "DC2"), | ||
| mockHost("local23", "127.0.0.23", "-7378697629483820646", "DC2"), | ||
| mockHost("local24", "127.0.0.24", "-6456360425798343065", "DC2"), | ||
| mockHost("local25", "127.0.0.25", "-5534023222112865484", "DC2"), | ||
| mockHost("local26", "127.0.0.26", "-4611686018427387903", "DC2"), | ||
| mockHost("local27", "127.0.0.27", "-3689348814741910323", "DC2"), | ||
| mockHost("local28", "127.0.0.28", "-2767011611056432742", "DC2"), | ||
| mockHost("local29", "127.0.0.29", "-1844674407370955161", "DC2"), | ||
| mockHost("local30", "127.0.0.30", "-922337203685477580", "DC2"), | ||
| mockHost("local31", "127.0.0.31", "1", "DC2"), | ||
| mockHost("local32", "127.0.0.32", "922337203685477581", "DC2"), | ||
| mockHost("local33", "127.0.0.33", "1844674407370955162", "DC2"), | ||
| mockHost("local34", "127.0.0.34", "2767011611056432743", "DC2"), | ||
| mockHost("local35", "127.0.0.35", "3689348814741910324", "DC2"), | ||
| mockHost("local36", "127.0.0.36", "4611686018427387905", "DC2"), | ||
| mockHost("local37", "127.0.0.37", "5534023222112865485", "DC2"), | ||
| mockHost("local38", "127.0.0.38", "6456360425798343066", "DC2"), | ||
| mockHost("local39", "127.0.0.39", "7378697629483820647", "DC2"), | ||
| mockHost("local40", "127.0.0.40", "8301034833169298228", "DC2") | ||
| mockHost("localhost1", "127.0.0.1", "-9223372036854775808", "DC1"), | ||
| mockHost("localhost2", "127.0.0.2", "-8301034833169298228", "DC1"), | ||
| mockHost("localhost3", "127.0.0.3", "-7378697629483820647", "DC1"), | ||
| mockHost("localhost4", "127.0.0.4", "-6456360425798343066", "DC1"), | ||
| mockHost("localhost5", "127.0.0.5", "-5534023222112865485", "DC1"), | ||
| mockHost("localhost6", "127.0.0.6", "-4611686018427387904", "DC1"), | ||
| mockHost("localhost7", "127.0.0.7", "-3689348814741910324", "DC1"), | ||
| mockHost("localhost8", "127.0.0.8", "-2767011611056432743", "DC1"), | ||
| mockHost("localhost9", "127.0.0.9", "-1844674407370955162", "DC1"), | ||
| mockHost("localhost10", "127.0.0.10", "-922337203685477581", "DC1"), | ||
| mockHost("localhost11", "127.0.0.11", "0", "DC1"), | ||
| mockHost("localhost12", "127.0.0.12", "922337203685477580", "DC1"), | ||
| mockHost("localhost13", "127.0.0.13", "1844674407370955161", "DC1"), | ||
| mockHost("localhost14", "127.0.0.14", "2767011611056432742", "DC1"), | ||
| mockHost("localhost15", "127.0.0.15", "3689348814741910323", "DC1"), | ||
| mockHost("localhost16", "127.0.0.16", "4611686018427387904", "DC1"), | ||
| mockHost("localhost17", "127.0.0.17", "5534023222112865484", "DC1"), | ||
| mockHost("localhost18", "127.0.0.18", "6456360425798343065", "DC1"), | ||
| mockHost("localhost19", "127.0.0.19", "7378697629483820646", "DC1"), | ||
| mockHost("localhost20", "127.0.0.20", "8301034833169298227", "DC1"), | ||
| mockHost("localhost21", "127.0.0.21", "-9223372036854775807", "DC2"), | ||
| mockHost("localhost22", "127.0.0.22", "-8301034833169298227", "DC2"), | ||
| mockHost("localhost23", "127.0.0.23", "-7378697629483820646", "DC2"), | ||
| mockHost("localhost24", "127.0.0.24", "-6456360425798343065", "DC2"), | ||
| mockHost("localhost25", "127.0.0.25", "-5534023222112865484", "DC2"), | ||
| mockHost("localhost26", "127.0.0.26", "-4611686018427387903", "DC2"), | ||
| mockHost("localhost27", "127.0.0.27", "-3689348814741910323", "DC2"), | ||
| mockHost("localhost28", "127.0.0.28", "-2767011611056432742", "DC2"), | ||
| mockHost("localhost29", "127.0.0.29", "-1844674407370955161", "DC2"), | ||
| mockHost("localhost30", "127.0.0.30", "-922337203685477580", "DC2"), | ||
| mockHost("localhost31", "127.0.0.31", "1", "DC2"), | ||
| mockHost("localhost32", "127.0.0.32", "922337203685477581", "DC2"), | ||
| mockHost("localhost33", "127.0.0.33", "1844674407370955162", "DC2"), | ||
| mockHost("localhost34", "127.0.0.34", "2767011611056432743", "DC2"), | ||
| mockHost("localhost35", "127.0.0.35", "3689348814741910324", "DC2"), | ||
| mockHost("localhost36", "127.0.0.36", "4611686018427387905", "DC2"), | ||
| mockHost("localhost37", "127.0.0.37", "5534023222112865485", "DC2"), | ||
| mockHost("localhost38", "127.0.0.38", "6456360425798343066", "DC2"), | ||
| mockHost("localhost39", "127.0.0.39", "7378697629483820647", "DC2"), | ||
| mockHost("localhost40", "127.0.0.40", "8301034833169298228", "DC2") | ||
| ); | ||
| when(metadata.getAllHosts()).thenReturn(allHosts); | ||
|
|
||
|
|
@@ -208,7 +208,7 @@ public String reverseResolve(String s) | |
| .compareTo(BigInteger.ONE) > 0)); | ||
| } | ||
|
|
||
| private static Host mockHost(String node, String ip, String token, String dc) | ||
| public static Host mockHost(String node, String ip, String token, String dc) | ||
| { | ||
| Host host = mock(Host.class, RETURNS_DEEP_STUBS); | ||
| when(host.getTokens()).thenAnswer(invocation -> Set.of(new MockToken(token))); | ||
|
|
@@ -282,12 +282,12 @@ private static TokenRange createMockTokenRange(Token start, Token end) | |
| } | ||
| } | ||
|
|
||
| protected DnsResolver mockDnsResolver() | ||
| public static DnsResolver mockDnsResolver() | ||
| { | ||
|
|
||
| Map<String, String> dnsMap = Map.of("local1", "127.0.0.1", | ||
| "local2", "127.0.0.2", | ||
| "local13", "127.0.0.3" | ||
| Map<String, String> dnsMap = Map.of("localhost", "127.0.0.1", | ||
| "localhost2", "127.0.0.2", | ||
| "localhost3", "127.0.0.3" | ||
| ); | ||
| DnsResolver dnsResolver = mock(DnsResolver.class); | ||
| try | ||
|
|
@@ -308,21 +308,21 @@ private InstancesMetadata mockInstancesMetadata() | |
| { | ||
| InstancesMetadata instancesMetadata = mock(InstancesMetadata.class); | ||
|
|
||
| InstanceMetadata instance1 = getMockInstanceMetaData(101000101, "local1", getMetadata()); | ||
| InstanceMetadata instance2 = getMockInstanceMetaData(101000201, "local2", getMetadata()); | ||
| InstanceMetadata instance3 = getMockInstanceMetaData(101000301, "local3", getMetadata()); | ||
| InstanceMetadata instance1 = getMockInstanceMetaData(101000101, "localhost", getMetadata()); | ||
| InstanceMetadata instance2 = getMockInstanceMetaData(101000201, "localhost2", getMetadata()); | ||
| InstanceMetadata instance3 = getMockInstanceMetaData(101000301, "localhost3", getMetadata()); | ||
| when(instancesMetadata.instances()).thenReturn(List.of(instance1, instance2, instance3)); | ||
| return instancesMetadata; | ||
| } | ||
|
|
||
| private Metadata getMetadata() | ||
| public static Metadata getMetadata() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above - purpose of scope promotion? If intentional we should either annotated |
||
| { | ||
| Metadata metadata = mock(Metadata.class); | ||
| when(metadata.getPartitioner()).thenReturn(Partitioners.MURMUR3.getClass().getSimpleName().toLowerCase()); | ||
| Set<Host> allHosts = Set.of( | ||
| mockHost("local1", "127.0.0.1", "-9223372036854775808", "DC1"), | ||
| mockHost("local2", "127.0.0.2", "-8301034833169298228", "DC1"), | ||
| mockHost("local3", "127.0.0.3", "-7378697629483820647", "DC1") | ||
| mockHost("localhost", "127.0.0.1", "-9223372036854775808", "DC1"), | ||
| mockHost("localhost2", "127.0.0.2", "-8301034833169298228", "DC1"), | ||
| mockHost("localhost3", "127.0.0.3", "-7378697629483820647", "DC1") | ||
| ); | ||
| when(metadata.getAllHosts()).thenReturn(allHosts); | ||
| return metadata; | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why the increase in scope from private to public? I don't see any new consumers in the PR...
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 am reusing these helper methods in TestModule to fix failing tests.