Differences

This shows you the differences between two versions of the page.

Link to this comparison view

irc:1472767200 [2017/05/27 13:44] (current)
Line 1: Line 1:
 +[07:48:55] <​antipsychiatry>​ Inform your frends : "You have no idea how cruel psychiatry is.
 +
 +[07:48:55] <​antipsychiatry>​ ... This is really a battle between good and evil."
 +
 +[07:48:55] <​antipsychiatry>​ Psychiatrist Peter R. Breggin
 +
 +[07:48:55] <​antipsychiatry>​ http://​www.wayneramsay.com/​evil.htm
 +
 +[07:55:21] <​myghty>​ hey guys :)
 +
 +[07:55:43] <​myghty>​ just a short question: I have two verticles interacting and would like to test that in a unit test
 +
 +[07:56:13] <​myghty>​ but as soon as I deploy both verticles in the before method I run into the problem that the unit-tests never finish
 +
 +[07:56:39] <​myghty>​ vertx.deployVerticle(SomeVerticle.class.getName(),​ context.asyncAssertSuccess());​
 +
 +[07:56:54] <​myghty>​ this is how I deploy both of them in the @Before thingy
 +
 +[08:07:09] <​myghty>​ I think this might be because I am not able to finish both async handlers...
 +
 +[08:07:20] <​myghty>​ any idea how to solve this?
 +
 +[08:29:18] <​temporal_>​ myghty why doesn'​t it finish ?
 +
 +[08:30:18] <​temporal_>​ what do you mean by finish ?
 +
 +[08:30:25] <​temporal_>​ the before phase does not end ?
 +
 +[08:30:28] <​temporal_>​ or the test itself ?
 +
 +[11:34:20] <​myghty>​ temporal_: the test itself
 +
 +[11:34:43] <​myghty>​ basically as soon as I do not deploy the secondVertical,​ it works fine
 +
 +[11:34:49] <​myghty>​ but since I need both... :(
 +
 +[11:35:02] <​temporal_>​ myghty so the test does not even begin ?
 +
 +[11:35:12] <​myghty>​ it does begin
 +
 +[11:35:14] <​myghty>​ walk through
 +
 +[11:35:26] <​myghty>​ well, let me paste you my code to pastebin
 +
 +[11:36:39] <​myghty>​ http://​pastebin.com/​DJgACe9U
 +
 +[11:37:07] <​myghty>​ It basically stops at line 25... or better: never does anything and after about 2 minutes my test fails
 +
 +[11:38:23] <​myghty>​ as soon as I remove line 6, it works fine
 +
 +[11:43:52] <​myghty>​ temporal_: any ideas? :)
 +
 +[11:45:10] <​temporal_>​ what does it print ?
 +
 +[11:45:18] <​temporal_>​ Setup completed at least ?
 +
 +[11:50:32] <​myghty>​ temporal_: it prints Async completed at last
 +
 +[11:50:43] <​myghty>​ but never finishes the testrun
 +
 +[11:51:02] <​temporal_>​ does it start testServiceRouterAvailability method ?
 +
 +[11:51:17] <​myghty>​ jep
 +
 +[11:51:21] <​myghty>​ it goes through the whole method
 +
 +[11:51:39] <​myghty>​ and prints all of the outputs there :)
 +
 +[11:51:40] <​temporal_>​ ok
 +
 +[11:51:51] <​temporal_>​ and teardown does not begin ?
 +
 +[11:52:00] <​myghty>​ looks like it
 +
 +[11:52:05] <​myghty>​ let me place another print there
 +
 +[11:52:46] <​temporal_>​ does it print "​System.out.println("​Async completed"​);"​ ?
 +
 +[11:53:26] <​myghty>​ jep
 +
 +[11:53:26] <​temporal_>​ btw you should set error handlers on the http client
 +
 +[11:53:27] <​myghty>​ it does
 +
 +[11:53:29] <​temporal_>​ ok
 +
 +[11:53:39] <​myghty>​ and it also completes the teardown
 +
 +[11:53:50] <​temporal_>​ so what is the problem :) ?
 +
 +[11:54:16] <​myghty>​ junit never shows the test as succesfull
 +
 +[11:54:23] <​myghty>​ it just holds there
 +
 +[11:54:26] <​myghty>​ and after 2 minutes
 +
 +[11:54:31] <​temporal_>​ ok
 +
 +[11:54:32] <​myghty>​ junit stops and notes the test as failed
 +
 +[11:54:40] <​temporal_>​ can you make a thread dump ?
 +
 +[11:54:47] <​myghty>​ mom
 +
 +[11:55:03] <​temporal_>​ if you could share a version it would be great
 +
 +[11:55:04] <​temporal_>​ need to go now
 +
 +[12:02:14] <​myghty>​ temporal_: http://​pastebin.com/​GarFHMvc :)
 +
 +[13:10:36] *** kornbluth.freenode.net sets mode: +o temporal_
 +
 +[13:25:13] <​AlexLehm>​ myghty: i think you cannot use asyncAssertSuccess twice in one method
 +
 +[14:08:50] <​myghty>​ AlexLehm: even if I take one of them (or even both) out, it does not work
 +
 +[14:09:10] <​AlexLehm>​ you have to start both asynchronous I think
 +
 +[14:09:11] <​myghty>​ only if I remove the deployment of the second verticle completely
 +
 +[14:15:09] <​AlexLehm>​ http://​pastebin.com/​jYJEsx1h
 +
 +[14:15:19] <​AlexLehm>​ could you please try ths
 +
 +[14:16:26] <​myghty>​ AlexLehm: gimme a sec :)
 +
 +[14:17:08] <​myghty>​ does not work as well
 +
 +[14:17:23] <​myghty>​ same behaviour
 +
 +[14:17:51] <​myghty>​ (btw to your offline message problem: as vert.x gets more and more popular I think there will be more and more experienced people around to answer questions faster :)
 +
 +[14:25:54] <​AlexLehm>​ yes probably
 +
 +[14:27:42] <​myghty>​ I guess at least I will be around way more often in the future :D just came across this and it got me ;P
 +
 +[14:27:55] <​myghty>​ still a lot to learn... but hey :) everyone starts out small
 +
 +[14:28:40] <​AlexLehm>​ yeah, you're right
 +
 +[14:29:07] <​AlexLehm>​ i will try your unit test with 2 verticles that just wait a few seconds on startup, maybe i can reproduce the issue
 +
 +[14:34:59] <​AlexLehm>​ i should point out one "​thinking error" I made a lot when testing vert.x code, if you write something like operation1() ;​operation2();​ log.info("​setup finished"​);,​ the log entry will happen before the operations are finished if they are async
 +
 +[14:35:11] <​AlexLehm>​ that is a bit misleading sometimes
 +
 +[15:02:36] <​AlexLehm>​ myghty: maybe an exception happens somewhere, can you try it like this https://​gist.github.com/​alexlehm/​7e0ee918bc1737c4bb2b1a49def70487
 +
 +[20:13:58] <​AlexLehm>​ myghty: you are right, they way its used in your test class, more than one async assert is working
 +
 +[20:14:34] <​AlexLehm>​ i have test working with a dummy server for the http, if the same is not working in our test, maybe the error happens in one of the classes under test