Skip to content

Commit 4cd8ac2

Browse files
liorsvexShinnRyuu
authored andcommitted
Python: fixed pypi-cd workflow, fixed release tests (#4703)
fixed pypi upload, fixed release tests Signed-off-by: Lior Sventitzky <liorsve@amazon.com>
1 parent 11e0b74 commit 4cd8ac2

File tree

4 files changed

+59
-53
lines changed

4 files changed

+59
-53
lines changed

.github/workflows/pypi-cd.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
if: github.repository_owner == 'valkey-io'
8686
name: Publish packages to PyPi
8787
runs-on: ${{ matrix.build.RUNNER }}
88-
timeout-minutes: 60
88+
timeout-minutes: 120
8989
strategy:
9090
fail-fast: false
9191
matrix:
@@ -422,6 +422,7 @@ jobs:
422422
- name: Async client - Download binaries
423423
uses: actions/download-artifact@v4
424424
with:
425+
pattern: wheels-*-async
425426
path: python/glide-async/wheels
426427
merge-multiple: true
427428

@@ -459,6 +460,7 @@ jobs:
459460
- name: Sync client - Download binaries
460461
uses: actions/download-artifact@v4
461462
with:
463+
pattern: wheels-*-sync
462464
path: python/glide-sync/wheels
463465
merge-multiple: true
464466

utils/release-candidate-testing/python/async_rc_test.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
# Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
22

33
import asyncio
4-
from typing import List
5-
from utils import start_servers, stop_servers, parse_cluster_script_start_output, create_client
4+
from typing import List, Union
65

7-
from glide import (
8-
GlideClient,
9-
NodeAddress,
10-
)
6+
from glide import (GlideClient, GlideClientConfiguration, GlideClusterClient,
7+
GlideClusterClientConfiguration, NodeAddress)
8+
9+
from utils import (parse_cluster_script_start_output, start_servers,
10+
stop_servers)
11+
12+
13+
def create_client(
14+
nodes_list: List[NodeAddress] = [("localhost", 6379)], is_cluster: bool = False
15+
) -> Union[GlideClusterClient, GlideClient]:
16+
addresses: List[NodeAddress] = nodes_list
17+
if is_cluster:
18+
config_class = GlideClusterClientConfiguration
19+
client_class = GlideClusterClient
20+
else:
21+
config_class = GlideClientConfiguration
22+
client_class = GlideClient
23+
config = config_class(
24+
addresses=addresses,
25+
client_name=f"test_{'cluster' if is_cluster else 'standalone'}_client",
26+
)
27+
return client_class.create(config)
1128

1229

1330
async def run_commands(client: GlideClient) -> None:
@@ -87,7 +104,7 @@ async def test_standalone_client() -> None:
87104
output = start_servers(False, 1, 1)
88105
servers, folder = parse_cluster_script_start_output(output)
89106
servers = [NodeAddress(hp.host, hp.port) for hp in servers]
90-
standalone_client = await create_client(servers, is_cluster=False, is_sync=False)
107+
standalone_client = await create_client(servers, is_cluster=False)
91108
await run_commands(standalone_client)
92109
stop_servers(folder)
93110
print("Async Standalone Client test completed")
@@ -98,7 +115,7 @@ async def test_cluster_client() -> None:
98115
output = start_servers(True, 3, 1)
99116
servers, folder = parse_cluster_script_start_output(output)
100117
servers = [NodeAddress(hp.host, hp.port) for hp in servers]
101-
cluster_client = await create_client(servers, is_cluster=True, is_sync=False)
118+
cluster_client = await create_client(servers, is_cluster=True)
102119
await run_commands(cluster_client)
103120
stop_servers(folder)
104121
print("Async Cluster Client test completed")

utils/release-candidate-testing/python/sync_rc_test.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11

2-
from typing import List
3-
from utils import start_servers, stop_servers, parse_cluster_script_start_output, create_client
2+
from typing import List, Union
3+
4+
from glide_sync import (GlideClient, GlideClientConfiguration,
5+
GlideClusterClient, GlideClusterClientConfiguration,
6+
NodeAddress)
7+
8+
from utils import (parse_cluster_script_start_output, start_servers,
9+
stop_servers)
10+
11+
12+
def create_client(
13+
nodes_list: List[NodeAddress] = [("localhost", 6379)], is_cluster: bool = False
14+
) -> Union[GlideClusterClient, GlideClient]:
15+
addresses: List[NodeAddress] = nodes_list
16+
if is_cluster:
17+
config_class = GlideClusterClientConfiguration
18+
client_class = GlideClusterClient
19+
else:
20+
config_class = GlideClientConfiguration
21+
client_class = GlideClient
22+
config = config_class(
23+
addresses=addresses,
24+
client_name=f"test_{'cluster' if is_cluster else 'standalone'}_client",
25+
)
26+
return client_class.create(config)
427

5-
from glide_sync import (
6-
GlideClient,
7-
NodeAddress,
8-
)
928

1029
def run_commands(client: GlideClient) -> None:
1130
print("Executing commands")
@@ -84,7 +103,7 @@ def test_standalone_client() -> None:
84103
output = start_servers(False, 1, 1)
85104
servers, folder = parse_cluster_script_start_output(output)
86105
servers = [NodeAddress(hp.host, hp.port) for hp in servers]
87-
standalone_client = create_client(servers, is_cluster=False, is_sync=True)
106+
standalone_client = create_client(servers, is_cluster=False)
88107
run_commands(standalone_client)
89108
stop_servers(folder)
90109
print("Standalone client test completed")
@@ -95,7 +114,7 @@ def test_cluster_client() -> None:
95114
output = start_servers(True, 3, 1)
96115
servers, folder = parse_cluster_script_start_output(output)
97116
servers = [NodeAddress(hp.host, hp.port) for hp in servers]
98-
cluster_client = create_client(servers, is_cluster=True, is_sync=True)
117+
cluster_client = create_client(servers, is_cluster=True)
99118
run_commands(cluster_client)
100119
stop_servers(folder)
101120
print("Cluster client test completed")

utils/release-candidate-testing/python/utils.py

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,8 @@
1-
from dataclasses import dataclass
21
import os
32
import subprocess
43
import sys
5-
from typing import List, Tuple, Union
6-
7-
from glide import (
8-
GlideClient,
9-
GlideClientConfiguration,
10-
GlideClusterClient,
11-
GlideClusterClientConfiguration,
12-
NodeAddress,
13-
)
14-
15-
from glide_sync import (
16-
GlideClient as SyncGlideClient,
17-
GlideClientConfiguration as SyncGlideClientConfiguration,
18-
GlideClusterClient as SyncGlideClusterClient,
19-
GlideClusterClientConfiguration as SyncGlideClusterClientConfiguration,
20-
NodeAddress as SyncNodeAddress,
21-
)
4+
from dataclasses import dataclass
5+
from typing import List, Tuple
226

237
SCRIPT_FILE = os.path.abspath(f"{__file__}/../../../cluster_manager.py")
248

@@ -27,7 +11,8 @@
2711
class HostPort:
2812
host: str
2913
port: int
30-
14+
15+
3116
def start_servers(cluster_mode: bool, shard_count: int, replica_count: int) -> str:
3217
args_list: List[str] = [sys.executable, SCRIPT_FILE]
3318
args_list.append("start")
@@ -86,20 +71,3 @@ def stop_servers(folder: str) -> str:
8671
raise Exception(f"Failed to stop the cluster. Executed: {p}:\n{err}")
8772
print("Servers stopped successfully")
8873
return output
89-
90-
91-
def create_client(
92-
nodes_list: List[Union[NodeAddress, SyncNodeAddress]] = [("localhost", 6379)], is_cluster: bool = False, is_sync: bool = False
93-
) -> GlideClusterClient:
94-
addresses: List[Union[NodeAddress, SyncNodeAddress]] = nodes_list
95-
if is_cluster:
96-
config_class = SyncGlideClusterClientConfiguration if is_sync else GlideClusterClientConfiguration
97-
client_class = SyncGlideClusterClient if is_sync else GlideClusterClient
98-
else:
99-
config_class = SyncGlideClientConfiguration if is_sync else GlideClientConfiguration
100-
client_class = SyncGlideClient if is_sync else GlideClient
101-
config = config_class(
102-
addresses=addresses,
103-
client_name=f"test_{'cluster' if is_cluster else 'standalone'}_client",
104-
)
105-
return client_class.create(config)

0 commit comments

Comments
 (0)