From 98fa91eb1a7eb1d7410295b73e92992ca78562a7 Mon Sep 17 00:00:00 2001
From: Fabio Pistolesi <fabio.pistolesi@forgerock.com>
Date: Wed, 03 Aug 2016 09:58:16 +0000
Subject: [PATCH] Temporarily work around file permissions checks when running the tests as root

---
 opendj-cli/src/test/java/com/forgerock/opendj/cli/UtilsTestCase.java |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/opendj-cli/src/test/java/com/forgerock/opendj/cli/UtilsTestCase.java b/opendj-cli/src/test/java/com/forgerock/opendj/cli/UtilsTestCase.java
index 18401c0..c116cf4 100644
--- a/opendj-cli/src/test/java/com/forgerock/opendj/cli/UtilsTestCase.java
+++ b/opendj-cli/src/test/java/com/forgerock/opendj/cli/UtilsTestCase.java
@@ -11,7 +11,7 @@
  * Header, with the fields enclosed by brackets [] replaced by your own identifying
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * Copyright 2014-2015 ForgeRock AS.
+ * Copyright 2014-2016 ForgeRock AS.
  */
 package com.forgerock.opendj.cli;
 
@@ -56,7 +56,15 @@
         f.setReadOnly();
         f.deleteOnExit();
         assertTrue(f.exists());
-        assertFalse(Utils.canWrite(f.getPath()));
+        if (!System.getProperty("user.name").equals("root")) {
+            // Expected behaviour
+            assertFalse(Utils.canWrite(f.getPath()));
+        } else {
+            // Workaround for running tests in Docker
+            // side effect of https://bugs.openjdk.java.net/browse/JDK-6931128,
+            // where file permissions are not enforced if user is root.
+            assertTrue(Utils.canWrite(f.getPath()));
+        }
     }
 
     @Test

--
Gitblit v1.10.0