Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add list of actual results to CLITest output when it fails #494

Merged
merged 1 commit into from
Dec 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion ksql-cli/src/test/java/io/confluent/ksql/TestRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;

import static junit.framework.TestCase.fail;
Expand Down Expand Up @@ -56,11 +59,15 @@ protected static void test(String command, TestResult.OrderedResult expectedResu

protected static void test(String command, TestResult expectedResult, boolean requireOrder) {
run(command, requireOrder);
final Collection<List<String>> finalResults = new ArrayList<>();
try {
TestUtils.waitForCondition(() -> {
TestResult actualResult = testTerminal.getTestResult();
finalResults.clear();
finalResults.addAll(actualResult.data);
return actualResult.data.containsAll(expectedResult.data);
}, 10000, "Did not get the expected result '" + expectedResult.toString() + ", in a timely fashion.");
}, 10000, "Did not get the expected result '" + expectedResult + ", in a timely fashion. Received " +
"following results instead: " + finalResults);
} catch (InterruptedException e) {
fail("Test got interrutped when waiting for result " + expectedResult.toString());
}
Expand Down