Skip to content

Commit a818973

Browse files
authored
COH-29294 - Add missing test for put with TTL (#109)
1 parent 1b1de77 commit a818973

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ override ENV_FILE := tests/utils/.env
3131
MVN_VERSION ?= 1.0.0
3232

3333
# Coherence CE version to run base tests against
34-
COHERENCE_VERSION ?= 22.06.5
34+
COHERENCE_VERSION ?= 22.06.7
3535
COHERENCE_GROUP_ID ?= com.oracle.coherence.ce
3636
COHERENCE_WKA1 ?= server1
3737
COHERENCE_WKA2 ?= server1
3838
CLUSTER_PORT ?= 7574
3939
# Profiles to include for building
40-
PROFILES ?=
40+
PROFILES ?= ",-jakarta,javax"
4141
COHERENCE_BASE_IMAGE ?= gcr.io/distroless/java17-debian11
4242

4343
# ----------------------------------------------------------------------------------------------------------------------

tests/test_client.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://oss.oracle.com/licenses/upl.
44

55
from asyncio import Event
6-
from time import time
6+
from time import sleep, time
77
from typing import Any, AsyncGenerator, Final, Optional, TypeVar
88

99
import pytest
@@ -94,6 +94,22 @@ async def test_get_and_put(setup_and_teardown: NamedCache[str, str | int | Perso
9494
assert r.address.city == Person.andy().address.city
9595

9696

97+
# noinspection PyShadowingNames
98+
@pytest.mark.asyncio
99+
async def test_put_with_ttl(setup_and_teardown: NamedCache[str, str | int]) -> None:
100+
cache: NamedCache[str, str | int | Person] = setup_and_teardown
101+
102+
k: str = "one"
103+
v: str = "only-one"
104+
await cache.put(k, v, 5000) # TTL of 5 seconds
105+
r = await cache.get(k)
106+
assert r == v
107+
108+
sleep(5) # sleep for 5 seconds
109+
r = await cache.get(k)
110+
assert r is None
111+
112+
97113
# noinspection PyShadowingNames
98114
@pytest.mark.asyncio
99115
async def test_put_if_absent(setup_and_teardown: NamedCache[str, str]) -> None:

0 commit comments

Comments
 (0)