You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2018/02/21 23:26:29 UTC

[GitHub] sijie closed pull request #1191: Fix GSSAPIBookKeeperTest

sijie closed pull request #1191: Fix GSSAPIBookKeeperTest
URL: https://github.com/apache/bookkeeper/pull/1191
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/sasl/GSSAPIBookKeeperTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/sasl/GSSAPIBookKeeperTest.java
index 3bfa82954..db39ae734 100644
--- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/sasl/GSSAPIBookKeeperTest.java
+++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/sasl/GSSAPIBookKeeperTest.java
@@ -28,13 +28,13 @@
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.net.InetAddress;
 import java.util.Arrays;
 import java.util.Enumeration;
 import java.util.Properties;
 import java.util.concurrent.atomic.AtomicLong;
 import javax.security.auth.login.Configuration;
 
+import org.apache.bookkeeper.bookie.Bookie;
 import org.apache.bookkeeper.client.BKException;
 import org.apache.bookkeeper.client.BKException.BKUnauthorizedAccessException;
 import org.apache.bookkeeper.client.BookKeeper;
@@ -82,7 +82,9 @@ public void startMiniKdc() throws Exception {
         kdc = new MiniKdc(conf, kdcDir.getRoot());
         kdc.start();
 
-        String localhostName = InetAddress.getLocalHost().getHostName();
+        ServerConfiguration bookieConf = newServerConfiguration();
+        bookieConf.setUseHostNameAsBookieID(true);
+        String localhostName = Bookie.getBookieAddress(bookieConf).getHostName();
 
         String principalServerNoRealm = "bookkeeper/" + localhostName;
         String principalServer = "bookkeeper/" + localhostName + "@" + kdc.getRealm();
@@ -172,12 +174,12 @@ private void connectAndWriteToBookie(ClientConfiguration conf, AtomicLong ledger
     /**
      * check if the entry exists. Restart the bookie to allow access
      */
-    private int entryCount(long ledgerId, ServerConfiguration bookieConf,
-        ClientConfiguration clientConf) throws Exception {
+    private int entryCount(long ledgerId, ClientConfiguration clientConf)
+            throws Exception {
         LOG.info("Counting entries in {}", ledgerId);
         for (ServerConfiguration conf : bsConfs) {
-            bookieConf.setUseHostNameAsBookieID(true);
-            bookieConf.setBookieAuthProviderFactoryClass(
+            conf.setUseHostNameAsBookieID(true);
+            conf.setBookieAuthProviderFactoryClass(
                 SASLBookieAuthProviderFactory.class.getName());
         }
         clientConf.setClientAuthProviderFactoryClass(
@@ -222,7 +224,7 @@ public void testSingleMessageAuth() throws Exception {
         connectAndWriteToBookie(clientConf, ledgerId); // should succeed
 
         assertFalse(ledgerId.get() == -1);
-        assertEquals("Should have entry", 1, entryCount(ledgerId.get(), bookieConf, clientConf));
+        assertEquals("Should have entry", 1, entryCount(ledgerId.get(), clientConf));
     }
 
     @Test


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services