Skip to content

Commit 630d733

Browse files
committed
COH-27562 - Fix Entries and Values paging tests - currently failing on GitHub Actions ONLY
1 parent 106d662 commit 630d733

File tree

4 files changed

+42
-25
lines changed

4 files changed

+42
-25
lines changed

coherence/client.py

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -820,18 +820,45 @@ def is_locked(self) -> bool:
820820

821821

822822
class Options:
823+
ENV_SERVER_ADDRESS = "COHERENCE_SERVER_ADDRESS"
824+
ENV_REQUEST_TIMEOUT = "COHERENCE_CLIENT_REQUEST_TIMEOUT"
825+
826+
DEFAULT_ADDRESS: Final[str] = "localhost:1408"
827+
"""The default target address to connect to Coherence gRPC server."""
828+
DEFAULT_SCOPE: Final[str] = ""
829+
"""The default scope."""
830+
DEFAULT_REQUEST_TIMEOUT: Final[float] = 30.0
831+
"""The default request timeout."""
832+
DEFAULT_FORMAT: Final[str] = "json"
833+
"""The default serialization format"""
834+
823835
def __init__(
824836
self,
825-
address: str,
826-
scope: str,
827-
request_timeout_seconds: float,
828-
ser_format: str,
837+
address: str = DEFAULT_ADDRESS,
838+
scope: str = DEFAULT_SCOPE,
839+
request_timeout_seconds: float = DEFAULT_REQUEST_TIMEOUT,
840+
ser_format: str = DEFAULT_FORMAT,
829841
channel_options: Optional[Sequence[Tuple[str, Any]]] = None,
830842
tls_options: Optional[TlsOptions] = None,
831843
) -> None:
832-
self._address = address
844+
addr = os.getenv(Options.ENV_SERVER_ADDRESS)
845+
if addr is not None:
846+
self._address = addr
847+
else:
848+
self._address = address
849+
850+
timeout = os.getenv(Options.ENV_REQUEST_TIMEOUT)
851+
if timeout is not None:
852+
time_out: float
853+
try:
854+
time_out = float(timeout)
855+
except ValueError:
856+
print(f"The value of {Options.ENV_REQUEST_TIMEOUT} cannot be converted to a float")
857+
self._request_timeout_seconds = time_out
858+
else:
859+
self._request_timeout_seconds = request_timeout_seconds
860+
833861
self._scope = scope
834-
self._request_timeout_seconds = request_timeout_seconds
835862
self._ser_format = ser_format
836863

837864
if channel_options is not None:
@@ -912,12 +939,6 @@ class Session:
912939
913940
"""
914941

915-
DEFAULT_ADDRESS: Final[str] = "localhost:1408"
916-
"""The default target address to connect to Coherence gRPC server."""
917-
DEFAULT_SCOPE: Final[str] = ""
918-
"""The default scope."""
919-
DEFAULT_REQUEST_TIMEOUT: Final[float] = 30.0
920-
"""The default request timeout."""
921942
DEFAULT_FORMAT: Final[str] = "json"
922943
"""The default serialization format"""
923944

@@ -931,9 +952,7 @@ def __init__(self, session_options: Optional[Options] = None):
931952
if session_options is not None:
932953
self._session_options = session_options
933954
else:
934-
self._session_options = Options(
935-
Session.DEFAULT_ADDRESS, Session.DEFAULT_SCOPE, Session.DEFAULT_REQUEST_TIMEOUT, Session.DEFAULT_FORMAT
936-
)
955+
self._session_options = Options()
937956

938957
self._tasks: Set[Task[None]] = set()
939958

@@ -1279,6 +1298,7 @@ async def __load_next_page(self) -> None:
12791298
:return: None
12801299
"""
12811300
request: PageRequest = self._client._request_factory.page_request(self._cookie)
1301+
print("### DEBUG: __load_next_page() called!")
12821302
self._stream = self._get_stream(request)
12831303
self._new_page = True
12841304

tests/java/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
188188
<jvmFlag>-Dcoherence.distributed.localstorage=true</jvmFlag>
189189
<jvmFlag>-Dcoherence.management.refresh.expiry=1s</jvmFlag>
190190
<jvmFlag>-Dcoherence.cacheconfig=${coherence.cache.config}</jvmFlag>
191+
<jvmFlag>-Dcoherence.distributed.partitioncount=13</jvmFlag>
191192
</jvmFlags>
192193
<mainClass>com.oracle.coherence.python.testing.RestServer</mainClass>
193194
<format>OCI</format>

tests/scripts/run-tests.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ set -e
1313
# INCLUDE_LONG_RUNNING=true
1414

1515
echo "Coherence CE 22.06.2"
16-
COHERENCE_VERSION=22.06.2 make clean test-cluster-shutdown remove-app-images build-test-images test-cluster-startup just-wait test
16+
COHERENCE_CLIENT_REQUEST_TIMEOUT=180.0 \
17+
COHERENCE_VERSION=22.06.2 \
18+
make clean test-cluster-shutdown remove-app-images build-test-images test-cluster-startup just-wait test
1719

1820
echo "Coherence CE 22.06.2 with SSL"
1921
RUN_SECURE=true COHERENCE_IGNORE_INVALID_CERTS=true \
2022
COHERENCE_TLS_CERTS_PATH=$(pwd)/tests/utils/certs/guardians-ca.crt \
2123
COHERENCE_TLS_CLIENT_CERT=$(pwd)/tests/utils/certs/star-lord.crt \
2224
COHERENCE_TLS_CLIENT_KEY=$(pwd)/tests/utils/certs/star-lord.pem \
25+
COHERENCE_CLIENT_REQUEST_TIMEOUT=180.0 \
2326
COHERENCE_VERSION=22.06.2 PROFILES=,secure make clean certs test-cluster-shutdown remove-app-images \
2427
build-test-images test-cluster-startup just-wait test

tests/test_client.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async def _insert_large_number_of_entries(cache: NamedCache[str, str]) -> int:
2727
# insert enough data into the cache to ensure results will be paged
2828
# by the proxy.
2929
num_bulk_ops: int = 10
30-
num_entries: int = 100000
30+
num_entries: int = 40000
3131
bulk_ops: int = int(num_entries / num_bulk_ops)
3232
to_send: dict[str, str] = {}
3333
for i in range(num_bulk_ops):
@@ -42,11 +42,6 @@ async def _insert_large_number_of_entries(cache: NamedCache[str, str]) -> int:
4242

4343

4444
def get_session() -> Session:
45-
default_address: Final[str] = "localhost:1408"
46-
default_scope: Final[str] = ""
47-
default_request_timeout: Final[float] = 30.0
48-
default_format: Final[str] = "json"
49-
5045
run_secure: Final[str] = "RUN_SECURE"
5146
session: Session = Session(None)
5247

@@ -60,7 +55,7 @@ def get_session() -> Session:
6055
tls_options.enabled = True
6156
tls_options.locked()
6257

63-
options: Options = Options(default_address, default_scope, default_request_timeout, default_format)
58+
options: Options = Options()
6459
options.tls_options = tls_options
6560
options.channel_options = (("grpc.ssl_target_name_override", "Star-Lord"),)
6661
session = Session(options)
@@ -269,7 +264,6 @@ async def test_entries_filtered(setup_and_teardown: NamedCache[str, str]) -> Non
269264

270265
# noinspection PyShadowingNames
271266
@pytest.mark.asyncio
272-
@pytest.mark.skip
273267
async def test_entries_paged(setup_and_teardown: NamedCache[str, str]) -> None:
274268
cache: NamedCache[str, str] = setup_and_teardown
275269

@@ -312,7 +306,6 @@ async def test_values_filtered(setup_and_teardown: NamedCache[str, str]) -> None
312306

313307
# noinspection PyShadowingNames
314308
@pytest.mark.asyncio
315-
@pytest.mark.skip
316309
async def test_values_paged(setup_and_teardown: NamedCache[str, str]) -> None:
317310
cache: NamedCache[str, str] = setup_and_teardown
318311

0 commit comments

Comments
 (0)