Updated Branches: refs/heads/flume-1.4 8fad6b880 -> d66700f81
FLUME-1943: ExecSource tests failing on Jenkins (Roshan Naik via Brock Noland) Project: http://git-wip-us.apache.org/repos/asf/flume/repo Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/d66700f8 Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/d66700f8 Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/d66700f8 Branch: refs/heads/flume-1.4 Commit: d66700f81882ddfa0641cbb4ce6751a8a2e0f3f0 Parents: 8fad6b8 Author: Brock Noland <[email protected]> Authored: Thu Mar 14 12:00:59 2013 -0500 Committer: Brock Noland <[email protected]> Committed: Thu Mar 14 12:01:10 2013 -0500 ---------------------------------------------------------------------- .../org/apache/flume/source/TestExecSource.java | 23 ++++++++------ 1 files changed, 13 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flume/blob/d66700f8/flume-ng-core/src/test/java/org/apache/flume/source/TestExecSource.java ---------------------------------------------------------------------- diff --git a/flume-ng-core/src/test/java/org/apache/flume/source/TestExecSource.java b/flume-ng-core/src/test/java/org/apache/flume/source/TestExecSource.java index 7c573f6..3d524f0 100644 --- a/flume-ng-core/src/test/java/org/apache/flume/source/TestExecSource.java +++ b/flume-ng-core/src/test/java/org/apache/flume/source/TestExecSource.java @@ -111,7 +111,7 @@ public class TestExecSource { @Test public void testShellCommandSimple() throws InterruptedException, LifecycleException, EventDeliveryException, IOException { - runTestShellCmdHelper("/bin/sh -c", "seq 5" + runTestShellCmdHelper("/bin/bash -c", "seq 5" , new String[]{"1","2","3","4","5" } ); } @@ -119,8 +119,8 @@ public class TestExecSource { public void testShellCommandBackTicks() throws InterruptedException, LifecycleException, EventDeliveryException, IOException { // command with backticks - runTestShellCmdHelper("/bin/sh -c", "echo `seq 5`" , new String[]{"1 2 3 4 5" } ); - runTestShellCmdHelper("/bin/sh -c", "echo $(seq 5)" , new String[]{"1 2 3 4 5" } ); + runTestShellCmdHelper("/bin/bash -c", "echo `seq 5`" , new String[]{"1 2 3 4 5" } ); + runTestShellCmdHelper("/bin/bash -c", "echo $(seq 5)" , new String[]{"1 2 3 4 5" } ); } @Test @@ -130,7 +130,7 @@ public class TestExecSource { String[] expected = {"1234", "abcd", "ijk", "xyz", "zzz"}; // pipes - runTestShellCmdHelper("/bin/sh -c", "echo zzz 1234 xyz abcd ijk | xargs -n1 echo | sort -f" + runTestShellCmdHelper("/bin/bash -c", "echo zzz 1234 xyz abcd ijk | xargs -n1 echo | sort -f" , expected ); } @@ -138,10 +138,10 @@ public class TestExecSource { public void testShellCommandScript() throws InterruptedException, LifecycleException, EventDeliveryException, IOException { // mini script - runTestShellCmdHelper("/bin/sh -c", "for i in {1..5}; do echo $i;done" + runTestShellCmdHelper("/bin/bash -c", "for i in {1..5}; do echo $i;done" , new String[]{"1","2","3","4","5" } ); // shell arithmetic - runTestShellCmdHelper("/bin/sh -c", "if ((2+2>3)); then echo good; else echo not good; fi" , new String[]{"good"} ); + runTestShellCmdHelper("/bin/bash -c", "if ((2+2>3)); then echo good; else echo not good; fi" , new String[]{"good"} ); } @Test @@ -154,15 +154,15 @@ public class TestExecSource { String command1 = reader.readLine(); Assert.assertNotNull(command1); String[] output1 = new String[] {"'1'", "\"2\"", "\\3", "\\4"}; - runTestShellCmdHelper("/bin/sh -c", command1 , output1); + runTestShellCmdHelper("/bin/bash -c", command1 , output1); String command2 = reader.readLine(); Assert.assertNotNull(command2); String[] output2 = new String[]{"1","2","3","4","5" }; - runTestShellCmdHelper("/bin/sh -c", command2 , output2); + runTestShellCmdHelper("/bin/bash -c", command2 , output2); String command3 = reader.readLine(); Assert.assertNotNull(command3); String[] output3 = new String[]{"2","3","4","5","6" }; - runTestShellCmdHelper("/bin/sh -c", command3 , output3); + runTestShellCmdHelper("/bin/bash -c", command3 , output3); } finally { reader.close(); } @@ -188,7 +188,10 @@ public class TestExecSource { outputStream.close(); transaction.commit(); List<String> output = Files.readLines(outputFile, Charset.defaultCharset()); - + System.out.println("command : " + command); + System.out.println("output : "); + for( String line : output ) + System.out.println(); Assert.assertArrayEquals(expectedOutput, output.toArray(new String[]{})); } finally { FileUtils.forceDelete(outputFile);
