-
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
fix intermittent error with CDS test #753
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@XcrigX out of curiosity, I put this through the debugger. The test passes, locally, and on Mac, but I'd prefer that it looks for something more explicit than 'length' > 25.
Your fix is no worse than what's there, but technically, a valid response could be:
{
"errorMessage": "CDS service doesn't exist"
}
Mind you, this is in a test, not production code.
I tried pulling a String out of the response to investigate, but almost always run into closed socket exceptions, and other weird stream related errors when trying this, and the test fails due to those exceptions.
Hi @dotasek - I don't disagree with you that the test could be designed better, I just know that it was failing on Windows (for me anyway), so I updated it to pass. |
.. and to your point, if you try to actually look at the string it consumes the steam which then causes the test to fail. I didn't dig in enough to determine how to get the string out and not then fail the test later - so that it could test for specific contents in the string rather than just the length. |
Yeah, it sounds like we both ran into the same issues. I'm just being nitpicky here. If this fixes things for Windows, and doesn't impact other systems, this is fine. Maybe a comment in the code would be appropriate? |
I'll add some comments there and push |
comments added |
I was getting an error running the CdsHooksServletIT.testCdsHooks() test on Windows. The test is blocking while it waits for the CDS Services to be "ready" by looking at the response from /cds-services. I was seeing an empty response from it initially like:
This empty response is 22 characters (on Windows), which is the minimum size that hasCdsServices() was looking for. So the test was continuing to run thinking the CDS services were "ready", but they were not.
This led to:
You can see just before the exception it is saying: "HAPI-2391: No service with id hello-world is registered on this server"
Changing the test response size to >22 causes it to wait for a non-empty response from /cds-services and the test then passes.
NOTE: This original test passed for me on a linux VM. It obviously runs here in github okay. But it was failing consistently on my Windows machine. Perhaps it's because on Linux the empty response is shorter than 22 chars due to line endings being different sizes?