File tree Expand file tree Collapse file tree
providers/gcp-secret-manager/src/test/java/dev/openfeature/contrib/providers/gcpsecretmanager Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,42 +64,16 @@ public Instant instant() {
6464 */
6565 @ Test
6666 void concurrentExpiryAndInsertDoNotLoseNewEntry () throws Exception {
67- // T0: entries inserted at this instant expire at T0 + 30 s
68- Instant t0 = Instant .parse ("2024-01-01T00:00:00Z" );
69- // T1: 31 s later — the "expired-value" entry is stale, but a new entry inserted here
70- // won't expire until T1 + 30 s = T0 + 61 s, which is safely in the future
71- Instant t1 = t0 .plusSeconds (31 );
72-
73- AtomicReference <Instant > now = new AtomicReference <>(t0 );
74- Clock clock = new Clock () {
75- @ Override
76- public ZoneOffset getZone () {
77- return ZoneOffset .UTC ;
78- }
79-
80- @ Override
81- public Clock withZone (java .time .ZoneId zone ) {
82- return this ;
83- }
84-
85- @ Override
86- public Instant instant () {
87- return now .get ();
88- }
89- };
90-
91- FlagCache cache = new FlagCache (Duration .ofSeconds (30 ), 100 , clock );
92-
9367 try (AllInterleavings interleavings =
9468 new AllInterleavings ("FlagCache concurrent expiry and re-insert" )) {
9569 while (interleavings .hasNext ()) {
9670 // Reset state for this interleaving:
9771 // - clock at T0 so the inserted entry records expiresAt = T0 + 30 s
98- now .set (t0 );
72+ now .set (T0 );
9973 cache .clear ();
10074 cache .put ("key" , "expired-value" );
10175 // - advance clock to T1 so the entry is now expired
102- now .set (t1 );
76+ now .set (T1 );
10377
10478 Runner .runParallel (
10579 // Thread A: re-insert the same key with a fresh value
You can’t perform that action at this time.
0 commit comments