Skip to content

COH-29294 - Add missing test for put with TTL #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ override ENV_FILE := tests/utils/.env
MVN_VERSION ?= 1.0.0

# Coherence CE version to run base tests against
COHERENCE_VERSION ?= 22.06.5
COHERENCE_VERSION ?= 22.06.7
COHERENCE_GROUP_ID ?= com.oracle.coherence.ce
COHERENCE_WKA1 ?= server1
COHERENCE_WKA2 ?= server1
CLUSTER_PORT ?= 7574
# Profiles to include for building
PROFILES ?=
PROFILES ?= ",-jakarta,javax"
COHERENCE_BASE_IMAGE ?= gcr.io/distroless/java17-debian11

# ----------------------------------------------------------------------------------------------------------------------
Expand Down
18 changes: 17 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://oss.oracle.com/licenses/upl.

from asyncio import Event
from time import time
from time import sleep, time
from typing import Any, AsyncGenerator, Final, Optional, TypeVar

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


# noinspection PyShadowingNames
@pytest.mark.asyncio
async def test_put_with_ttl(setup_and_teardown: NamedCache[str, str | int]) -> None:
cache: NamedCache[str, str | int | Person] = setup_and_teardown

k: str = "one"
v: str = "only-one"
await cache.put(k, v, 5000) # TTL of 5 seconds
r = await cache.get(k)
assert r == v

sleep(5) # sleep for 5 seconds
r = await cache.get(k)
assert r is None


# noinspection PyShadowingNames
@pytest.mark.asyncio
async def test_put_if_absent(setup_and_teardown: NamedCache[str, str]) -> None:
Expand Down