Fix intermittent test failure.

This commit is contained in:
Diederik Muylwyk 2019-09-25 15:32:39 -04:00
parent 30588bf8ee
commit 729d3a3d3b
1 changed files with 4 additions and 11 deletions

View File

@ -70,6 +70,7 @@ import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;
import static ca.uhn.fhir.jpa.util.TestUtil.sleepAtLeast;
import static ca.uhn.fhir.jpa.util.TestUtil.sleepOneClick;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.hamcrest.Matchers.*;
@ -3900,10 +3901,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
}
ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute();
/*
* First, make sure that we don't reuse a search if
* it's not marked with an expiry
*/
{
myDaoConfig.setReuseCachedSearchResultsForMillis(10L);
Bundle result1 = ourClient
@ -3912,20 +3910,16 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
.returnBundle(Bundle.class)
.execute();
final String uuid1 = toSearchUuidFromLinkNext(result1);
sleepOneClick();
sleepAtLeast(11L);
Bundle result2 = ourClient
.search()
.forResource("Organization")
.returnBundle(Bundle.class)
.execute();
final String uuid2 = toSearchUuidFromLinkNext(result2);
assertNotEquals(uuid1, uuid2); // TODO: DM 2019-09-24 - This assertion fails intermittently.
assertNotEquals(uuid1, uuid2);
}
/*
* Now try one but mark it with an expiry time
* in the future
*/
{
myDaoConfig.setReuseCachedSearchResultsForMillis(1000L);
Bundle result1 = ourClient
@ -3946,7 +3940,6 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
.returnBundle(Bundle.class)
.execute();
// Expiry doesn't affect reusablility
final String uuid2 = toSearchUuidFromLinkNext(result2);
assertEquals(uuid1, uuid2);