Bug 6486 - Add waits for IT Utils 48/44448/1
authorSam Hague <shague@redhat.com>
Mon, 22 Aug 2016 02:02:51 +0000 (22:02 -0400)
committerSam Hague <shague@redhat.com>
Mon, 22 Aug 2016 02:02:51 +0000 (22:02 -0400)
Change-Id: I9e537ecf65cf4c88408213760b8119b7be709505
Signed-off-by: Sam Hague <shague@redhat.com>
utils/ovsdb-it-utils/src/main/java/org/opendaylight/ovsdb/utils/ovsdb/it/utils/DockerOvs.java
utils/ovsdb-it-utils/src/main/java/org/opendaylight/ovsdb/utils/ovsdb/it/utils/ProcUtils.java

index 6a066d15e23fab7854fdebb7c394034b44e710f9..ee11d04b0ef55e28ea38c2c48d7f14d0324198c2 100644 (file)
@@ -328,6 +328,15 @@ public class DockerOvs implements AutoCloseable {
         ProcUtils.runProcess(waitFor, cmd);
     }
 
+    public int runInContainer(int reserved, int waitFor, int numOvs, String ... cmdWords)
+            throws IOException, InterruptedException {
+        String[] pfx = getExecCmdPrefix(numOvs);
+        String[] cmd = new String[pfx.length + cmdWords.length];
+        System.arraycopy(pfx, 0, cmd, 0, pfx.length);
+        System.arraycopy(cmdWords, 0, cmd, pfx.length, cmdWords.length);
+        return ProcUtils.runProcess(reserved, waitFor, null, cmd);
+    }
+
     public void tryInContainer(String logText, int waitFor, int numOvs, String ... cmdWords) throws IOException, InterruptedException {
         String[] pfx = getExecCmdPrefix(numOvs);
         String[] cmd = new String[pfx.length + cmdWords.length];
index 24f69c1e3a75d10fe315e39274732c8046001c6a..d6d01eb111b344c5d925ca9bb23e80ca32da132c 100644 (file)
@@ -48,6 +48,13 @@ public class ProcUtils {
         Assert.assertEquals("ProcUtils.runProcess exit code is not 0", 0, exitValue);
     }
 
+    public static int runProcess(int reserved, long waitFor, StringBuilder capturedStdout, String... words)
+            throws IOException, InterruptedException {
+        int exitValue = tryProcess(null, waitFor, capturedStdout, words);
+        LOG.info("ProcUtils.runProcess exit code: ", exitValue);
+        return exitValue;
+    }
+
     /**
      * Run a process.
      * @param waitFor How long to wait for the command to execute