You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I have two API-Endpoints, getA() and getB() which return ResultA and ResultB respectively. Both are mocked using Mockinizer. Both Endpoints are queried at the same time. In a good number of cases the getA() query will end up getting the ResultB response, and vice versa.
My guess is that both results are intercepted by Mockinizer, the responses are enqueued into MockServer, but MockServer handles the two responses in the opposide order, leading to the wrong response being given out.
I've verified that retrofit actually receives the wrong response by logging to json body of for the two endpoints.
To Reproduce
Very simply put, I have this set-up.
interfaceTestInterface {
@GET("/v1/a")
suspendfungetA(): Response<ResultA>
@GET("/v1/b")
suspendfungetB(): Response<ResultB>
}
classRepository {
funloadA() {
GlobalScope.launch {
valresultA = retrofit.createInterface(...).getA() // sometimes fails because my mock response for getB can't be converted to ResultA
}
}
funloadB() {
GlobalScope.launch {
valresultB = retrofit.createInterface(...).getB() // sometimes fails because my mock response for getA can't be converted to ResultB
}
}
}
funsomeFunction() {
repository.loadA()
repository.loadB()
}
At the moment I'm trying to understand the issue and figure out if I'm misusing something or if Mockinizer+MockServer is the culprit. I'll see if I can create a minimal test sample to showcase the problem.
In the meantime, I thought I'd ask whether you've seen issues like that previously.
PS: Perhaps to add, in the past I've used this method to handle giving out mock responses, rather than enqueue. Maybe that's a good way to go.
The text was updated successfully, but these errors were encountered:
Hi @JuBan1 parallel mocking of api responses isn't something that I have tested yet with Mockinizer. Your assumption that dispatch instead enqueue might be better for that case seem to be correct to me. I'll try that out.
Thanks for your investigation efforts!
Describe the bug
I have two API-Endpoints,
getA()
andgetB()
which returnResultA
andResultB
respectively. Both are mocked using Mockinizer. Both Endpoints are queried at the same time. In a good number of cases thegetA()
query will end up getting theResultB
response, and vice versa.My guess is that both results are intercepted by Mockinizer, the responses are enqueued into MockServer, but MockServer handles the two responses in the opposide order, leading to the wrong response being given out.
I've verified that retrofit actually receives the wrong response by logging to json body of for the two endpoints.
To Reproduce
Very simply put, I have this set-up.
At the moment I'm trying to understand the issue and figure out if I'm misusing something or if Mockinizer+MockServer is the culprit. I'll see if I can create a minimal test sample to showcase the problem.
In the meantime, I thought I'd ask whether you've seen issues like that previously.
PS: Perhaps to add, in the past I've used this method to handle giving out mock responses, rather than
enqueue
. Maybe that's a good way to go.The text was updated successfully, but these errors were encountered: