[tor-commits] [collector/master] Tests now point at empty temporary 'in' directory. This prevents lengthy import operations that appear as a hanging test.

karsten at torproject.org karsten at torproject.org
Wed Jul 13 15:46:09 UTC 2016


commit 4b79249fefa73a89dfeda3ed5793905ddc6d7a8a
Author: iwakeh <iwakeh at torproject.org>
Date:   Wed Jul 13 16:18:07 2016 +0200

    Tests now point at empty temporary 'in' directory.  This prevents lengthy import operations that appear as a hanging test.
---
 src/test/java/org/torproject/collector/MainTest.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/torproject/collector/MainTest.java b/src/test/java/org/torproject/collector/MainTest.java
index 55b0569..a948070 100644
--- a/src/test/java/org/torproject/collector/MainTest.java
+++ b/src/test/java/org/torproject/collector/MainTest.java
@@ -57,12 +57,17 @@ public class MainTest {
   private void changeLockFilePath(File f, File l) throws Exception {
     List<String> lines = Files.readAllLines(f.toPath());
     BufferedWriter bw = Files.newBufferedWriter(f.toPath());
+    File in = tmpf.newFolder();
     File out = tmpf.newFolder();
+    String inStr = "in/";
+    String outStr = "out/";
     for(String line : lines) {
       if (line.contains(Key.LockFilePath.name())) {
         line = Key.LockFilePath.name() + " = " + l.toString();
-      } else if (line.contains("out")) {
-        line = line.replace("out", out.toString() + "out");
+      } else if (line.contains(inStr)) {
+        line = line.replace(inStr, in.toString() + inStr);
+      } else if (line.contains(outStr)) {
+        line = line.replace(outStr, out.toString() + outStr);
       }
       bw.write(line);
       bw.newLine();



More information about the tor-commits mailing list