-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Moco is not stopped when run within container #72
Comments
It is funny because if I add
then it works. It seems like Netty takes some time to kill the threads. |
Could you please tell me which version you are using? |
The latest one the 0.9.1. For what I have seen it seems that the group of threads are not stopped immediately and synchronously because the server warns about the fact that some threads were created but not terminated. |
I have tried in another computer with the sleep to 3000 but the problem appears again:
|
It's Netty which didn't shutdown server as expected. I actually put a latency in the code from 0.9.1. Maybe I'll dig more. |
Ok I think it would be great to make some researching on this problem. I am thinking to open an issue to Netty people to see if they can address the problem because at least adding latency is only a patch not the real solution. Thank you so much. |
I have found a solution to this problem. I have read on Netty documentation that shutdownGracefully returns a Future class which means that you can synchronize and wait until threads are completely closed. So I have tried this modification on MocoServer class: WARNING: it is not suitable for production code:
And now it works perfectly. Notice that I have added the BTW it would be awesome if I could have this issue fixed before 25th of April, do you think it will be possible to have a 0.9.2 version released before that date? Thank you so much. |
It's really a good suggestion. In my current plan, the next release will in May 1st. I can publish snapshot version anytime. Can I know more about your release plan? |
Well my plan is to release this weekend the first alpha version of the extension (because there are some users that are waiting for start using it 😄 Then for two weeks I expect their feedback and what can be improved and then release the alpha2, and after some more testing (and I would like that you as a creator of Moco also takes a look so you can suggest any missing point), I will release the first stable version. In parallel of this on 25th of April I am going to talk in Barcelona JUG about Arquillian, NoMocks movement, Stubbs and so on and I would like to present Moco (and the extension) to all of them so I think that an snapshot version of Moco published would be awesome. If you want I send you a pull request no problem, as you can see the change is really easy. Thank you so much. |
Also I would like to use this issue to comment one issue I have found: I am using next json file as expectation:
And I start Moco with next code:
And next exception is thrown: [http-bio-50884-exec-3] INFO Unrecognized field: Unrecognized field "json" (class com.github.dreamhead.moco.parser.model.ResponseSetting), not marked as ignorable (9 known properties: "headers", "path_resource", "text", "proxy", "cookies", "status", "version", "file", "latency"]) What I am doing wrong here? If instead of json type I add text then it works as expected. Thank you so much. |
json api in json will be published in the next version. If you really want to use it, you can build Moco by yourself. |
Ok I have already done 👍 but do you think you could publish a 0.9.2.Alpha1 version on maven central repo? This would help me in publishing the first alpha of Arquillian-extension-Moco. Thank you so much for your help. |
Do you want I send you a pull request for shutting down Runner or you will implement it? I ask it to close this issue or attach a PR. |
It would be better if you can create PR with test cases for that. |
Hello I am developing the arquillian-extension-moco so we can run moco server internally from container automatically while running Arquillian tests instead of having to do manually.
It works great but there is one error when shutting down the Moco server. Let me show you the important code:
This method is called before executing any test and reads a passed json request/response Moco file and starts the runner
and then to stop it:
the problem is that when you run it inside a container and without debugging then an exception that a thread group could not be stopped in an amount of time is thrown. But the funny thing is that if I try to debug then all works as expected.
So the first question is, Am I doing something wrong in the way I start and stop Moco server?
The text was updated successfully, but these errors were encountered: