akpatnam25 commented on code in PR #3455:
URL: https://github.com/apache/celeborn/pull/3455#discussion_r2335675812
##########
master/src/test/java/org/apache/celeborn/service/deploy/master/clustermeta/ha/RatisMasterStatusSystemSuiteJ.java:
##########
@@ -1939,6 +1950,66 @@ public void testHandleReportWorkerDecommission() throws
InterruptedException {
Assert.assertEquals(2, STATUSSYSTEM3.availableWorkers.size());
}
+ @Test
+ public void testRedirectToLeaderForRegistration() throws Throwable {
+ CelebornConf celebornConf = new CelebornConf();
+ celebornConf.set("celeborn.shuffle.io.maxRetries", "1");
+ celebornConf.set("celeborn.network.bind.preferIpAddress", "false");
+ TransportConf conf = new TransportConf("shuffle", celebornConf);
+
+ // if server1 is the leader, pick server2, else server1 - so that it is
always a follower
+ AbstractMetaManager followerStatusSystem =
+ RATISSERVER1.isLeader() ? STATUSSYSTEM2 : STATUSSYSTEM1;
+
+ SecretRegistry registry =
+ new SecretRegistry() {
+ // Only canRegisterElseReturnFailure is relevant for this test, rest
dont matter
+ public String getSecretKey(String appId) {
+ return null;
+ }
+
+ public boolean isRegistered(String appId) {
+ return false;
+ }
+
+ public void register(String appId, String secret) {}
+
+ public void unregister(String appId) {}
+
+ public void ensureRegistrationAllowed() throws IOException {
+ // what MasterSecretRegistryImpl does - except we purposefully
pick a follower
+
MasterSecretRegistryImpl.ensureRegistrationAllowedImpl(followerStatusSystem,
false);
+ }
+ };
+
+ RegistrationServerBootstrap serverBootstrap = new
RegistrationServerBootstrap(conf, registry);
+ RegistrationClientBootstrap clientBootstrap =
+ new RegistrationClientBootstrap(
+ conf, "app", new SaslCredentials("user", "password"), new
RegistrationInfo());
+ try {
+ SaslTestBase.authHelper(conf, serverBootstrap, clientBootstrap);
+ fail("Should have redirected to leader");
+ } catch (Exception e) {
+ assertTrue(e.getCause() instanceof MasterNotLeaderException);
+ MasterNotLeaderException notLeaderException = (MasterNotLeaderException)
e.getCause();
+
+ HARaftServer leader =
Review Comment:
yes, we already do verify it is leader. We need it to check whether it got
redirected to the leader below this line
--
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]