-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-5152. Fix Suggested leader in Client. #2189
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
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
02681f2
HDDS-5152. Fix Suggested leader in Client.
bharatviswa504 382d2b6
fix other failoverproxy
bharatviswa504 0fc375b
a
bharatviswa504 037d11c
fix other proxy provider and fix cs
bharatviswa504 f375d58
add safety check of groupcount
bharatviswa504 9438a2c
fix fb
bharatviswa504 b611f24
fix cs
bharatviswa504 b220e0c
fix review comments
bharatviswa504 0269c36
fix review comments
bharatviswa504 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
82 changes: 82 additions & 0 deletions
82
...-hdds/common/src/test/java/org/apache/hadoop/hdds/ratis/TestServerNotLeaderException.java
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 |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * <p> | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * <p> | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.hadoop.hdds.ratis; | ||
|
|
||
| import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; | ||
| import org.junit.Assert; | ||
| import org.junit.Test; | ||
|
|
||
| /** Class to test {@link ServerNotLeaderException} parsing. **/ | ||
|
|
||
| @SuppressFBWarnings("NM_CLASS_NOT_EXCEPTION") | ||
| public class TestServerNotLeaderException { | ||
| @Test | ||
| public void testServerNotLeaderException() { | ||
|
|
||
| // Test hostname with "." | ||
| final String msg = | ||
| "Server:cf0bc565-a41b-4784-a24d-3048d5a5b013 is not the leader. " | ||
| + "Suggested leader is Server:scm5-3.scm5.root.hwx.site:9863"; | ||
| ServerNotLeaderException snle = new ServerNotLeaderException(msg); | ||
| Assert.assertEquals(snle.getSuggestedLeader(), "scm5-3.scm5.root.hwx" + | ||
| ".site:9863"); | ||
|
|
||
| String message = "Server:7fdd7170-75cc-4e11-b343-c2657c2f2f39 is not the " + | ||
| "leader.Suggested leader is Server:scm5-3.scm5.root.hwx.site:9863 \n" + | ||
| "at org.apache.hadoop.hdds.ratis.ServerNotLeaderException" + | ||
| ".convertToNotLeaderException(ServerNotLeaderException.java:96)"; | ||
| snle = new ServerNotLeaderException(message); | ||
| Assert.assertEquals("scm5-3.scm5.root.hwx.site:9863", | ||
| snle.getSuggestedLeader()); | ||
|
|
||
| // Test hostname with out "." | ||
| message = "Server:7fdd7170-75cc-4e11-b343-c2657c2f2f39 is not the " + | ||
| "leader.Suggested leader is Server:localhost:98634 \n" + | ||
| "at org.apache.hadoop.hdds.ratis.ServerNotLeaderException" + | ||
| ".convertToNotLeaderException(ServerNotLeaderException.java:96)"; | ||
| snle = new ServerNotLeaderException(message); | ||
| Assert.assertEquals("localhost:98634", | ||
| snle.getSuggestedLeader()); | ||
|
|
||
| message = "Server:7fdd7170-75cc-4e11-b343-c2657c2f2f39 is not the " + | ||
| "leader.Suggested leader is Server::98634 \n" + | ||
| "at org.apache.hadoop.hdds.ratis.ServerNotLeaderException" + | ||
| ".convertToNotLeaderException(ServerNotLeaderException.java:96)"; | ||
| snle = new ServerNotLeaderException(message); | ||
| Assert.assertEquals(null, | ||
| snle.getSuggestedLeader()); | ||
|
|
||
| message = "Server:7fdd7170-75cc-4e11-b343-c2657c2f2f39 is not the " + | ||
| "leader.Suggested leader is Server:localhost:98634:8988 \n" + | ||
| "at org.apache.hadoop.hdds.ratis.ServerNotLeaderException" + | ||
| ".convertToNotLeaderException(ServerNotLeaderException.java:96)"; | ||
| snle = new ServerNotLeaderException(message); | ||
| Assert.assertEquals("localhost:98634", | ||
| snle.getSuggestedLeader()); | ||
|
|
||
| message = "Server:7fdd7170-75cc-4e11-b343-c2657c2f2f39 is not the " + | ||
| "leader.Suggested leader is Server:localhost \n" + | ||
| "at org.apache.hadoop.hdds.ratis.ServerNotLeaderException" + | ||
| ".convertToNotLeaderException(ServerNotLeaderException.java)"; | ||
| snle = new ServerNotLeaderException(message); | ||
| Assert.assertEquals(null, | ||
| snle.getSuggestedLeader()); | ||
| } | ||
|
|
||
| } | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.