Comments (13)
Furthermore, if any exception occurs inside Runnable.run method consecutive test fails also to start (despite of using workaround described by @marcingrzejszczak)
from moco.
@marcingrzejszczak Have you described your scenario correctly? Because your second piece of code create another server instance which is different the first server instance and will return nothing.
from moco.
Yes the scenario is correct. Imagine that you have two @test methods that each start a new http server in the same way - that's what I do here in the test : I create a server, start it, run some logic, stop it, create a new server, start it, run logic, stop it. The second server creation fails.
@Test
public void some_test1() {
HttpServer server = httpServer(...)
running(...)
}
/**
An exception will be thrown in this test most presumably due to closing of the connection
**/
@Test
public void some_test2() {
HttpServer server = httpServer(...)
running(...)
}
You are reffering to the fact that I am not setting the response? You're right but It didn't matter since the connection never took place. - ok I fixed the test and you were right (my mistake) - there was an exception due to bad request. So I can't reproduce this issue in the Moco tests but we do have it in our testing code.
from moco.
Confirmed, it's definitely an issue. I'll try to fix it.
from moco.
So you did manage to reproduce it? Could you please show such a test scenario since we were unable to create one in your code base?
from moco.
Sorry, I did not reproduce it. I guess the issue is caused by Netty Asynchronous Model. Most of my test cases are all synchronised. When the test try to shutdown server, it just call shutdown method which does not mean the server has already completely shut down and some socket still work until it finish its own job.
I can figure out a solution. But I'm not sure it works very well because it not that easy to reproduce it.
from moco.
Is it possible for you to write down a solution here? We could then try to install a changed version of Moco oin our side and verify if the problem is fixed.
And you are talking about which error - issue related to starting of Moco server in test suites or when exception is thrown in the Runnable part?
from moco.
Try await() or sync() variants for bossGroup and workerGroup in MocoServer class.
This issue is related to starting Moco server, actually, related to stopping server.
from moco.
It turned out that we have already done some variants of await() or sync() and it didn't change anything :(
from moco.
Sorry for that late. Too busy on my personal work.
The difficulty for me is I can not reproduce it in my local environment. I remembered that one of my friends had this issue before. I've ask him to reproduce it. One other solution is to use your workaround in stop method. I'll add this workaround as temporary solution.
from moco.
Like I said I'm pretty sure that the workaround will not work properly since we've already tried to implement it.
from moco.
That's awesome! That change should work - will try to test it ASAP. When are you planning a release?
from moco.
0.9.1, Feb 1st.
from moco.
Related Issues (20)
- default if json.req.prop not available HOT 1
- MOCO如何实现带参重定向 HOT 1
- socket请求实现多文件配置
- java.lang.IllegalArgumentException: unknown configuration
- Maven test fails to run moco server when using jacoco maven plugin 0.7.8 or newer #258
- Use URI path parameters on the response template HOT 6
- 返回值类型不支持xml HOT 2
- java.lang.IllegalArgumentException: unknown configuration :[Z@78073c4 HOT 2
- 请求参数中存在中文时,每次请求都报400,怎么进行解决? HOT 1
- 响应体中存在奇数个汉字的时候必定乱码 HOT 5
- 如何支持或的逻辑,以及如何支持对字段名采用正则匹配
- ERROR java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
- 请求超过10MB报错,有配置的地方吗 HOT 3
- 返回response json时,template无法使用
- 加载配置文件无法使用*.json HOT 5
- Asynchronous, Duplicate key Accept-Encoding HOT 3
- 希望能支持响应json直接使用模板语法
- The json in the configuration request needs to match all the json in the body in order for the test to pass HOT 2
- 功能请求: 支持Http SSE(Server-Send Events) API 相关mock能力 HOT 1
- Response header 同时配置content-type & content-length, 响应卡住
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moco.