sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ak...@apache.org
Subject sentry git commit: SENTRY-1718: TestSentryStore often fails in setup() (Na Li, reviewed by: Alex Kolbasov)
Date Fri, 28 Apr 2017 23:13:29 GMT
Repository: sentry
Updated Branches:
  refs/heads/sentry-ha-redesign 14b3b904a -> 3722abec4


SENTRY-1718:  TestSentryStore often fails in setup() (Na Li, reviewed by: Alex Kolbasov)


Project: http://git-wip-us.apache.org/repos/asf/sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/3722abec
Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/3722abec
Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/3722abec

Branch: refs/heads/sentry-ha-redesign
Commit: 3722abec4ea077566c46b8221f3b050d2e0dbf86
Parents: 14b3b90
Author: Alexander Kolbasov <akolb@cloudera.com>
Authored: Fri Apr 28 16:12:58 2017 -0700
Committer: Alexander Kolbasov <akolb@cloudera.com>
Committed: Fri Apr 28 16:12:58 2017 -0700

----------------------------------------------------------------------
 .../db/service/persistent/TestSentryStore.java        | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/3722abec/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java
b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java
index acf8732..e7443eb 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java
@@ -93,10 +93,18 @@ public class TestSentryStore extends org.junit.Assert {
     conf = new Configuration(false);
     final String ourUrl = UserProvider.SCHEME_NAME + ":///";
     conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, ourUrl);
+
+    // THis should be a UserGroupInformation provider
     CredentialProvider provider = CredentialProviderFactory.getProviders(conf).get(0);
-    provider.createCredentialEntry(ServerConfig.
-        SENTRY_STORE_JDBC_PASS, passwd);
-    provider.flush();
+
+
+    // The user credentials are stored as a static variable by UserGrouoInformation provider.
+    // We need to only set the password the first time, an attempt to set it for the second
+    // time fails with an exception.
+    if(provider.getCredentialEntry(ServerConfig.SENTRY_STORE_JDBC_PASS) == null) {
+      provider.createCredentialEntry(ServerConfig.SENTRY_STORE_JDBC_PASS, passwd);
+      provider.flush();
+    }
 
     dataDir = new File(Files.createTempDir(), "sentry_policy_db");
     conf.set(ServerConfig.SENTRY_VERIFY_SCHEM_VERSION, "false");


Mime
View raw message