Skip to content

Commit 02e4de7

Browse files
authored
Merge pull request #753 from XcrigX/fix-cds-test-race
fix intermittent error with CDS test
2 parents 48a141b + 85aab81 commit 02e4de7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,14 @@ void beforeEach() {
8888

8989
private Boolean hasCdsServices() throws IOException {
9090
var response = callCdsServicesDiscovery();
91-
return response.getEntity().getContentLength() > 21 || response.getEntity().isChunked();
91+
92+
// NOTE: this is looking for a repsonse that indicates there are CDS services availalble.
93+
// And empty response looks like: {"services": []}
94+
// Looking at the actual response string consumes the InputStream which has side-effects, making it tricky to compare the actual contents.
95+
// Hence the test just looks at the length to make this determination.
96+
// The actual response has newlines in it which vary in size on some systems, but a value of 25 seems to work across linux/mac/windows
97+
// to ensure the repsonse actually contains CDS services in it
98+
return response.getEntity().getContentLength() > 25 || response.getEntity().isChunked();
9299
}
93100

94101
private CloseableHttpResponse callCdsServicesDiscovery() {

0 commit comments

Comments
 (0)