Skip to content

Commit 74bab4f

Browse files
committed
Added some output to help if fn operation fails
1 parent 1771916 commit 74bab4f

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

integration-tests/src/main/java/com/fnproject/fn/integrationtest/IntegrationTestRule.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ private CmdResult(String cmd, boolean success, String stdout, String stderr) {
112112

113113
boolean isSuccess() {
114114
return success;
115-
116115
}
117116

118117
public String getStdout() {
@@ -123,7 +122,9 @@ public String getStderr() {
123122
return stderr;
124123
}
125124

126-
125+
public String toString() {
126+
return "CmdResult: cmd=" + cmd + ", success=" + success + ", stdout=" + stdout + ", stderr=" + stderr;
127+
}
127128
}
128129

129130
public class TestContext {
@@ -151,6 +152,9 @@ public TestContext withDirFrom(String location) throws IOException {
151152
public CmdResult runFnWithInput(String input, String... args) throws Exception {
152153
CmdResult res = runFnWithInputAllowError(input, args);
153154

155+
if (!res.isSuccess()) {
156+
System.err.println(res);
157+
}
154158
Assertions.assertThat(res.isSuccess()).withFailMessage("Expected command '" + res.cmd + "' to return 0").isTrue();
155159
return res;
156160
}

integration-tests/src/test/java/com/fnproject/fn/integrationtest/FunctionsTest.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ public void shouldCallExistingFn() throws Exception {
3535
tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local");
3636
tc.runFn("config", "app", tc.appName(), "GREETING", "Salutations");
3737

38-
3938
CmdResult r1 = tc.runFnWithInput("", "invoke", tc.appName(), "simplefunc");
4039
assertThat(r1.getStdout()).isEqualTo("Salutations, world!");
4140

42-
4341
CmdResult r2 = tc.runFnWithInput("tests", "invoke", tc.appName(), "simplefunc");
4442
assertThat(r2.getStdout()).isEqualTo("Salutations, tests!");
4543

@@ -56,10 +54,6 @@ public void checkBoilerPlate() throws Exception {
5654
tc.rewritePOM();
5755
tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local");
5856
CmdResult rs = tc.runFnWithInput("wibble", "invoke", tc.appName(), fnName);
59-
System.out.println("TEST OUT: " + rs.getStdout());
60-
System.out.println("TEST ERR: " + rs.getStderr());
61-
Logger.getAnonymousLogger.log(Level.INFO, "TEST OUT: " + rs.getStdout());
62-
Logger.getAnonymousLogger.log(Level.INFO, "TEST ERR: " + rs.getStderr());
6357
assertThat(rs.getStdout()).contains("Hello, wibble!");
6458
}
6559
}

0 commit comments

Comments
 (0)