[java-oidc-common] branch main updated: Fix testStaleMetadata_Success test, set last update in the past

Phil Smart philip.smart at jisc.ac.uk
Mon Oct 18 13:40:40 UTC 2021


This is an automated email from the git hooks/post-receive script.

philsmart pushed a commit to branch main
in repository java-oidc-common.

View the commit online:
http://git.shibboleth.net/view/?p=java-oidc-common.git;a=commit;h=b3573b73ae53b7958feff59b5bd848c702edc957

The following commit(s) were added to refs/heads/main by this push:
     new b3573b7  Fix testStaleMetadata_Success test, set last update in the past
b3573b7 is described below

commit b3573b73ae53b7958feff59b5bd848c702edc957
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Mon Oct 18 14:40:35 2021 +0100

    Fix testStaleMetadata_Success test, set last update in the past
---
 .../oidc/metadata/cache/impl/DynamicMetadataCacheTest.java   | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCacheTest.java b/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCacheTest.java
index 0a7b1a4..989b8a6 100644
--- a/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCacheTest.java
+++ b/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCacheTest.java
@@ -254,6 +254,9 @@ public class DynamicMetadataCacheTest {
         mgmtData.setExpirationTime(now.minus(Duration.ofMinutes(10)));
         // refresh is needed
         mgmtData.setRefreshTriggerTime(now.minus(Duration.ofMinutes(10)));
+        // set last update in the past to avoid clock tick issues
+        final Instant firstUpdateTime = now.minus(Duration.ofSeconds(5));
+        mgmtData.setLastUpdateTime(firstUpdateTime);        
         
         // create some metadata to add - probably ignored as needs refreshing
         OIDCProviderMetadata metadata =
@@ -264,14 +267,11 @@ public class DynamicMetadataCacheTest {
         //should exist in the cache
         assertFalse(cache.getBackingStore().getIndexedValues().isEmpty());
         assertFalse(cache.getBackingStore().getOrderedValues().isEmpty());
-        // should have been created now
-        assertTrue(mgmtData.getLastUpdateTime().equals(now));
-        
-        Thread.sleep(200);
+       
         cache.get(new CriteriaSet(new IssuerIDCriterion(iss)));
         
-        // should have been updated after now
-        assertFalse(mgmtData.getLastUpdateTime().equals(now));
+        // should have been updated after firstUpdateTime.
+        assertTrue(mgmtData.getLastUpdateTime().isAfter(firstUpdateTime));
         
     }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list