htrace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmcc...@apache.org
Subject incubator-htrace git commit: HTRACE-296. htraced tests: make sure local settings for HTRACED_WEB_DIR and HTRACE_CONF_DIR don't affect unit tests (cmccabe)
Date Thu, 12 Nov 2015 20:38:59 GMT
Repository: incubator-htrace
Updated Branches:
  refs/heads/master c2defc7a0 -> ef46897ff


HTRACE-296. htraced tests: make sure local settings for HTRACED_WEB_DIR and HTRACE_CONF_DIR
don't affect unit tests (cmccabe)


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

Branch: refs/heads/master
Commit: ef46897ff31b90628d06648169175f33c06f2291
Parents: c2defc7
Author: Colin P. Mccabe <cmccabe@apache.org>
Authored: Thu Nov 12 12:38:43 2015 -0800
Committer: Colin P. Mccabe <cmccabe@apache.org>
Committed: Thu Nov 12 12:38:43 2015 -0800

----------------------------------------------------------------------
 .../java/org/apache/htrace/impl/HTracedProcess.java    | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/ef46897f/htrace-htraced/src/test/java/org/apache/htrace/impl/HTracedProcess.java
----------------------------------------------------------------------
diff --git a/htrace-htraced/src/test/java/org/apache/htrace/impl/HTracedProcess.java b/htrace-htraced/src/test/java/org/apache/htrace/impl/HTracedProcess.java
index 5c5e394..ff81e83 100644
--- a/htrace-htraced/src/test/java/org/apache/htrace/impl/HTracedProcess.java
+++ b/htrace-htraced/src/test/java/org/apache/htrace/impl/HTracedProcess.java
@@ -28,6 +28,7 @@ import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.URI;
 import java.nio.file.Paths;
+import java.util.Map;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -143,6 +144,18 @@ class HTracedProcess extends Process {
         "-Ddata.store.clear=true",
         "-Dstartup.notification.address=localhost:" + listener.getLocalPort(),
         "-Ddata.store.directories=" + dataDir.get().getAbsolutePath());
+
+      // Set HTRACED_CONF_DIR to the temporary directory we just created, to
+      // ensure that it doesn't pull in any other configuration file that might
+      // be on this test machine.
+      Map<String, String> env = pb.environment();
+      env.put("HTRACED_CONF_DIR", dataDir.get().getAbsolutePath());
+
+      // Remove any HTRACED_WEB_DIR variable that might be set, to ensure that
+      // we use the default value (which finds the local web files by relative
+      // path).
+      env.remove("HTRACED_WEB_DIR");
+
       pb.redirectErrorStream(true);
       // Inherit STDERR/STDOUT i/o; dumps on console for now.  Can add logs later.
       pb.inheritIO();


Mime
View raw message