11package io .hyperfoil .tools .qdup .cmd .impl ;
22
3+ import io .hyperfoil .tools .qdup .JsonServer ;
34import io .hyperfoil .tools .qdup .Run ;
45import io .hyperfoil .tools .qdup .SshTestBase ;
56import io .hyperfoil .tools .qdup .State ;
1314import io .hyperfoil .tools .qdup .config .yaml .Parser ;
1415import io .hyperfoil .tools .yaup .Sets ;
1516import io .hyperfoil .tools .yaup .json .Json ;
17+ import io .vertx .core .Vertx ;
1618import org .junit .Assert ;
1719import org .junit .Ignore ;
1820import 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