You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by va...@apache.org on 2017/06/14 00:56:42 UTC

[04/52] [abbrv] sentry git commit: SENTRY-1718: TestSentryStore often fails in setup() (Na Li, reviewed by: Alex Kolbasov)

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

Change-Id: Ied7c0cccbe9a9dccc5467820f10e757687b06f0b
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/22195
Tested-by: Jenkins User
Reviewed-by: Alexander Kolbasov <ak...@cloudera.com>


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

Branch: refs/for/cdh5-1.5.1_ha
Commit: d419afed08df3ed740fad1824d3f4666e280cf39
Parents: 0dbe38a
Author: Alexander Kolbasov <ak...@cloudera.com>
Authored: Fri Apr 28 16:15:14 2017 -0700
Committer: Alexander Kolbasov <ak...@cloudera.com>
Committed: Fri Apr 28 17:15:53 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/d419afed/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 4d8a091..610380c 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
@@ -100,10 +100,18 @@ public class TestSentryStore {
     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");