Closed XcrigX closed 3 weeks ago
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. My theory is that linux/mac use a 1-character line ending, so testing for >22 worked to indicate a non-empty response. Windows uses a 2-character line ending so a non-empty response is slightly longer.
.. 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?