Skip to content

Commit bc5946e

Browse files
committed
Fix TarantoolConsole response parsing
Now, CONNECTED_PATTERN has become multi lined that allows the console to skip extra lines before the connected one (for instance, warning lines). Also unexpected 'enter' command was removed which produced errors in the output.
1 parent aec9fff commit bc5946e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/test/java/org/tarantool/TarantoolConsole.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public abstract class TarantoolConsole implements Closeable {
2525

2626
private static final int TIMEOUT = 2000;
2727
private static final Pattern GREETING_PATTERN = Pattern.compile("^Tarantool.+\n.+\n");
28-
private static final Pattern CONNECTED_PATTERN = Pattern.compile("^connected to (.*)\n");
28+
private static final Pattern CONNECTED_PATTERN = Pattern.compile("^connected to (.*)\n", Pattern.MULTILINE);
2929
private static final Pattern REPLY_PATTERN = Pattern.compile("^.*\\n\\.{3}\\n",
3030
Pattern.UNIX_LINES | Pattern.DOTALL);
3131

@@ -214,7 +214,7 @@ private static class TarantoolLocalConsole extends TarantoolConsole {
214214
Map<String, String> env = builder.environment();
215215
env.put("PWD", workDir);
216216
env.put("TEST_WORKDIR", workDir);
217-
env.put("COLUMNS", "256");
217+
env.put("COLUMNS", "1024");
218218
builder.redirectErrorStream(true);
219219
builder.directory(new File(workDir));
220220

@@ -226,7 +226,6 @@ private static class TarantoolLocalConsole extends TarantoolConsole {
226226
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
227227
writer = new OutputStreamWriter(process.getOutputStream());
228228

229-
write("enter " + instance);
230229
Matcher m = expect(CONNECTED_PATTERN);
231230
name = m.group(1);
232231
prompt = Pattern.compile(Pattern.quote(name + "> "));

0 commit comments

Comments
 (0)