Repository: incubator-sentry Updated Branches: refs/heads/master 7598d6829 -> 6e0def2cb
SENTRY-271: Test TestSentryServiceIntegration is flaky( Jarek Jarcec Cecho via Sravya Tirukkovalur) Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/6e0def2c Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/6e0def2c Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/6e0def2c Branch: refs/heads/master Commit: 6e0def2cbc09872c3500bdbdb68ec1b796a2d620 Parents: 7598d68 Author: Sravya Tirukkovalur <[email protected]> Authored: Fri Jun 6 19:12:53 2014 -0700 Committer: Sravya Tirukkovalur <[email protected]> Committed: Fri Jun 6 19:12:53 2014 -0700 ---------------------------------------------------------------------- .../service/thrift/SentryServiceIntegrationBase.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/6e0def2c/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java index f3142fe..b3bd1ef 100644 --- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java +++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java @@ -18,6 +18,7 @@ package org.apache.sentry.service.thrift; import java.io.File; +import java.net.UnknownHostException; import java.security.PrivilegedExceptionAction; import java.util.HashSet; import java.util.Set; @@ -54,7 +55,18 @@ public abstract class SentryServiceIntegrationBase extends KerberosSecurityTestc } } - protected static final String SERVER_HOST = "localhost"; + protected static final String SERVER_HOST; + static { + String serverHost; + try { + // Dynamically find name of local interface + serverHost = java.net.InetAddress.getLocalHost().getHostName().toLowerCase(); + } catch (UnknownHostException e) { + LOGGER.error("Can't get localhost proper hostname, missing /etc/hosts configuration? Using 'localhost'.", e); + serverHost = "localhost"; // default value is simply localhost + } + SERVER_HOST = serverHost; + } protected static final String REALM = "EXAMPLE.COM"; protected static final String SERVER_PRINCIPAL = "sentry/" + SERVER_HOST; protected static final String SERVER_KERBEROS_NAME = "sentry/" + SERVER_HOST + "@" + REALM;
