hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vvasu...@apache.org
Subject [28/50] hadoop git commit: HADOOP-13178. TestShellBasedIdMapping.testStaticMapUpdate doesn't work on OS X (Kai Sasaki via aw)
Date Wed, 25 May 2016 16:58:24 GMT
HADOOP-13178. TestShellBasedIdMapping.testStaticMapUpdate doesn't work on OS X (Kai Sasaki
via aw)


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

Branch: refs/heads/YARN-4757
Commit: d8c1fd1944160ad5b5d093731ae987d701802321
Parents: 39ec151
Author: Allen Wittenauer <aw@apache.org>
Authored: Sat May 21 10:00:36 2016 -0700
Committer: Allen Wittenauer <aw@apache.org>
Committed: Sat May 21 10:00:36 2016 -0700

----------------------------------------------------------------------
 .../apache/hadoop/security/ShellBasedIdMapping.java |  2 +-
 .../hadoop/security/TestShellBasedIdMapping.java    | 16 +++++++++++-----
 2 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/d8c1fd19/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ShellBasedIdMapping.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ShellBasedIdMapping.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ShellBasedIdMapping.java
index 27761da..e45ac8c 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ShellBasedIdMapping.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ShellBasedIdMapping.java
@@ -85,7 +85,7 @@ public class ShellBasedIdMapping implements IdMappingServiceProvider {
   private static final Pattern EMPTY_LINE = Pattern.compile("^\\s*$");
   private static final Pattern COMMENT_LINE = Pattern.compile("^\\s*#.*$");
   private static final Pattern MAPPING_LINE =
-      Pattern.compile("^(uid|gid)\\s+(\\d+)\\s+(\\d+)\\s*(#.*)?$");
+      Pattern.compile("^(uid|gid)\\s+(\\d+)\\s+(0|-?[1-9]\\d*)\\s*(#.*)?$");
 
   final private long timeout;
   

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d8c1fd19/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestShellBasedIdMapping.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestShellBasedIdMapping.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestShellBasedIdMapping.java
index 3b533d2..e395247 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestShellBasedIdMapping.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestShellBasedIdMapping.java
@@ -148,8 +148,9 @@ public class TestShellBasedIdMapping {
     // getUid()
     incrIdMapping.clearNameMaps();
     uidNameMap = refIdMapping.getUidNameMap();
-    {
-      BiMap.Entry<Integer, String> me = uidNameMap.entrySet().iterator().next();
+    for (BiMap.Entry<Integer, String> me : uidNameMap.entrySet()) {
+      tempStaticMapFile.delete();
+      incrIdMapping.clearNameMaps();
       Integer id = me.getKey();
       String name = me.getValue();
 
@@ -174,8 +175,9 @@ public class TestShellBasedIdMapping {
     // getGid()
     incrIdMapping.clearNameMaps();
     gidNameMap = refIdMapping.getGidNameMap();
-    {
-      BiMap.Entry<Integer, String> me = gidNameMap.entrySet().iterator().next();
+    for (BiMap.Entry<Integer, String> me : gidNameMap.entrySet()) {
+      tempStaticMapFile.delete();
+      incrIdMapping.clearNameMaps();
       Integer id = me.getKey();
       String name = me.getValue();
 
@@ -189,7 +191,11 @@ public class TestShellBasedIdMapping {
       Integer rid = id + 10000;
       String smapStr = "gid " + rid + " " + id;
       // Sleep a bit to avoid that two changes have the same modification time
-      try {Thread.sleep(1000);} catch (InterruptedException e) {}
+      try {
+        Thread.sleep(100);
+      } catch (InterruptedException e) {
+        // Do nothing
+      }
       createStaticMapFile(tempStaticMapFile, smapStr);
 
       // Now the id found for "name" should be the id specified by


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message