You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2023/03/18 15:05:20 UTC

[pulsar] 01/02: [test] Fix MockMutableAuthenticationState implementation

This is an automated email from the ASF dual-hosted git repository.

mmarshall pushed a commit to branch branch-2.11
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit ad06fac08862544cfe6b787ad65bc590680a9163
Author: Michael Marshall <mm...@apache.org>
AuthorDate: Sat Mar 18 09:36:49 2023 -0500

    [test] Fix MockMutableAuthenticationState implementation
    
    When https://github.com/apache/pulsar/pull/19519 was
    cherry-picked to branch-2.11, it did not implement the
    authenticate method in the MockMutableAuthenticationState,
    which led to several test failures in the ServerCnxTest class.
    This commit fixes those tests.
    
    Note that the issue is only in the test code.
---
 .../apache/pulsar/broker/auth/MockMutableAuthenticationState.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/auth/MockMutableAuthenticationState.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/auth/MockMutableAuthenticationState.java
index c04913a1fd8..65963bdae00 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/auth/MockMutableAuthenticationState.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/auth/MockMutableAuthenticationState.java
@@ -19,6 +19,7 @@
 package org.apache.pulsar.broker.auth;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
+import java.util.concurrent.ExecutionException;
 import javax.naming.AuthenticationException;
 import java.util.concurrent.CompletableFuture;
 import org.apache.pulsar.broker.authentication.AuthenticationDataCommand;
@@ -47,7 +48,11 @@ public class MockMutableAuthenticationState implements AuthenticationState {
 
     @Override
     public AuthData authenticate(AuthData authData) throws AuthenticationException {
-        return null;
+        try {
+            return this.authenticateAsync(authData).get();
+        } catch (InterruptedException | ExecutionException e) {
+            throw new RuntimeException(e);
+        }
     }
 
     /**