Skip to content

Commit c52629f

Browse files
committed
chore: fix testes
1 parent 8fd454a commit c52629f

1 file changed

Lines changed: 12 additions & 32 deletions

File tree

tests/test_sync_client.py

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,39 +1656,19 @@ def test_per_request_context_overrides_replane_client_id(self, mock_server: Mock
16561656
== "per-request-value"
16571657
)
16581658

1659-
def test_unique_replane_client_id_per_client_instance(self, mock_server: MockSSEServer):
1659+
def test_unique_replane_client_id_per_client_instance(self):
16601660
"""Each client instance gets a unique replaneClientId."""
1661-
config = create_config(
1662-
"feature",
1663-
"default",
1664-
overrides=[
1665-
create_override(
1666-
"50-percent-rollout",
1667-
"rollout-value",
1668-
[
1669-
{
1670-
"operator": "segmentation",
1671-
"property": "replaneClientId",
1672-
"fromPercentage": 0,
1673-
"toPercentage": 50,
1674-
"seed": "test-seed",
1675-
}
1676-
],
1677-
),
1678-
],
1679-
)
1680-
1681-
# Create multiple clients and check they get different segmentation results
1682-
results = []
1661+
# Create multiple client instances and collect their auto-generated IDs
1662+
# We don't need to connect - the ID is generated at construction time
1663+
client_ids = set()
16831664
for _ in range(10):
1684-
# Each client connection needs its own init event
1685-
mock_server.send_init([config])
1686-
with Replane(
1687-
base_url=mock_server.url,
1665+
client = Replane(
1666+
base_url="http://localhost:9999", # Won't connect
16881667
sdk_key="rp_test_key",
1689-
) as client:
1690-
results.append(client.configs["feature"])
1668+
)
1669+
client_id = client._context.get("replaneClientId")
1670+
assert client_id is not None, "replaneClientId should be auto-generated"
1671+
client_ids.add(client_id)
16911672

1692-
# With 10 clients and 50% rollout, we should statistically see both values
1693-
# This test mainly verifies that segmentation is working
1694-
assert "rollout-value" in results or "default" in results
1673+
# All 10 clients should have unique IDs
1674+
assert len(client_ids) == 10, "Each client should get a unique replaneClientId"

0 commit comments

Comments
 (0)