Skip to content

Commit 23e907f

Browse files
committed
fix for-each testing in new container image
1 parent 173a0bf commit 23e907f

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

qDup-core/src/test/java/io/hyperfoil/tools/qdup/cmd/impl/ForEachTest.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.hyperfoil.tools.qdup.cmd.impl;
22

3+
import io.hyperfoil.tools.qdup.JsonServer;
34
import io.hyperfoil.tools.qdup.Run;
45
import io.hyperfoil.tools.qdup.SshTestBase;
56
import io.hyperfoil.tools.qdup.State;
@@ -13,6 +14,7 @@
1314
import io.hyperfoil.tools.qdup.config.yaml.Parser;
1415
import io.hyperfoil.tools.yaup.Sets;
1516
import io.hyperfoil.tools.yaup.json.Json;
17+
import io.vertx.core.Vertx;
1618
import org.junit.Assert;
1719
import org.junit.Ignore;
1820
import org.junit.Test;
@@ -272,6 +274,7 @@ public void nested_loop_objects_from_state() {
272274

273275
Dispatcher dispatcher = new Dispatcher();
274276
Run doit = new Run(tmpDir.toString(), config, dispatcher);
277+
doit.ensureConsoleLogging();
275278
doit.run();
276279
dispatcher.shutdown();
277280
assertEquals("FOO should loop over bar entries", " one=1 one=2 one=3 two=2 two=4 two=6 three=3 three=6 three=9", config.getState().get("LOG"));
@@ -1365,13 +1368,13 @@ public void yaml_declared() {
13651368
assertEquals("for-each should run 3 times entries:\n" + splits.stream().collect(Collectors.joining("\n")), 3, splits.size());
13661369
}
13671370

1368-
@Test
1371+
@Test //hanging
13691372
public void forEach_ls1_loop() {
13701373
List<String> lines = new ArrayList<>();
13711374
AtomicBoolean tail = new AtomicBoolean(false);
13721375
Script runScript = new Script("run");
13731376
runScript
1374-
.then(Cmd.sh("rm -r /tmp/foo"))
1377+
.then(Cmd.sh("rm -rf /tmp/foo"))
13751378
.then(Cmd.sh("mkdir /tmp/foo"))
13761379
.then(Cmd.sh("echo \"one\" > /tmp/foo/one.txt"))
13771380
.then(Cmd.sh("echo \"two\" > /tmp/foo/two.txt"))
@@ -1389,11 +1392,10 @@ public void forEach_ls1_loop() {
13891392
tail.set(true);
13901393
return Result.next(input);
13911394
})))
1392-
.then(Cmd.sh("rm -r /tmp/foo"))
1395+
.then(Cmd.sh("rm -rf /tmp/foo"))
13931396
;
13941397

13951398
RunConfigBuilder builder = getBuilder();
1396-
13971399
builder.addScript(runScript);
13981400
builder.addHostAlias("local", getHost().toString());
13991401
builder.addHostToRole("role", "local");
@@ -1403,9 +1405,17 @@ public void forEach_ls1_loop() {
14031405
assertFalse("unexpected errors:\n" + config.getErrorStrings().stream().collect(Collectors.joining("\n")), config.hasErrors());
14041406

14051407
Dispatcher dispatcher = new Dispatcher();
1408+
14061409
Run run = new Run(tmpDir.toString(), config, dispatcher);
1410+
run.ensureConsoleLogging();
1411+
1412+
JsonServer jsonServer = new JsonServer(Vertx.vertx(),run,31337);
1413+
jsonServer.start();
1414+
14071415
run.run();
14081416

1417+
jsonServer.stop();
1418+
14091419
assertEquals("lines contains 3 entries:\n" + lines, 4, lines.size());
14101420
assertTrue("tail should be called", tail.get());
14111421
}

0 commit comments

Comments
 (0)