devcycle-python-server-sdk 3.6.0__py3-none-any.whl → 3.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- devcycle_python_sdk/VERSION.txt +1 -1
- devcycle_python_sdk/api/config_client.py +1 -1
- devcycle_python_sdk/api/local_bucketing.py +5 -2
- devcycle_python_sdk/bucketing-lib.release.wasm +0 -0
- devcycle_python_sdk/local_client.py +3 -1
- devcycle_python_sdk/managers/event_queue_manager.py +2 -1
- {devcycle_python_server_sdk-3.6.0.dist-info → devcycle_python_server_sdk-3.7.0.dist-info}/METADATA +7 -7
- {devcycle_python_server_sdk-3.6.0.dist-info → devcycle_python_server_sdk-3.7.0.dist-info}/RECORD +16 -16
- {devcycle_python_server_sdk-3.6.0.dist-info → devcycle_python_server_sdk-3.7.0.dist-info}/WHEEL +1 -1
- test/api/test_config_client.py +1 -1
- test/api/test_local_bucketing.py +17 -11
- test/managers/test_event_queue_manager.py +39 -11
- test/openfeature_test/test_provider_local_sdk.py +1 -1
- test/test_local_client.py +2 -2
- {devcycle_python_server_sdk-3.6.0.dist-info → devcycle_python_server_sdk-3.7.0.dist-info}/LICENSE +0 -0
- {devcycle_python_server_sdk-3.6.0.dist-info → devcycle_python_server_sdk-3.7.0.dist-info}/top_level.txt +0 -0
devcycle_python_sdk/VERSION.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.7.0
|
|
@@ -30,7 +30,7 @@ class ConfigAPIClient:
|
|
|
30
30
|
self.max_config_retries = 2
|
|
31
31
|
self.config_file_url = (
|
|
32
32
|
slash_join(
|
|
33
|
-
self.options.config_cdn_uri, "config", "
|
|
33
|
+
self.options.config_cdn_uri, "config", "v2", "server", self.sdk_key
|
|
34
34
|
)
|
|
35
35
|
+ ".json"
|
|
36
36
|
)
|
|
@@ -289,10 +289,13 @@ class LocalBucketing:
|
|
|
289
289
|
|
|
290
290
|
return bytes(ret)
|
|
291
291
|
|
|
292
|
-
def init_event_queue(self, options_json: str) -> None:
|
|
292
|
+
def init_event_queue(self, client_uuid, options_json: str) -> None:
|
|
293
293
|
with self.wasm_lock:
|
|
294
|
+
client_uuid_addr = self._new_assembly_script_string(client_uuid)
|
|
294
295
|
options_addr = self._new_assembly_script_string(options_json)
|
|
295
|
-
self.initEventQueue(
|
|
296
|
+
self.initEventQueue(
|
|
297
|
+
self.wasm_store, self.sdk_key_addr, client_uuid_addr, options_addr
|
|
298
|
+
)
|
|
296
299
|
|
|
297
300
|
def get_variable_for_user_protobuf(
|
|
298
301
|
self, user: DevCycleUser, key: str, default_value: Any
|
|
Binary file
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
|
+
import uuid
|
|
3
4
|
from numbers import Real
|
|
4
5
|
from typing import Any, Dict, Union
|
|
5
6
|
|
|
@@ -28,6 +29,7 @@ class DevCycleLocalClient(AbstractDevCycleClient):
|
|
|
28
29
|
def __init__(self, sdk_key: str, options: DevCycleLocalOptions):
|
|
29
30
|
_validate_sdk_key(sdk_key)
|
|
30
31
|
self._sdk_key = sdk_key
|
|
32
|
+
self.client_uuid = str(uuid.uuid4())
|
|
31
33
|
|
|
32
34
|
if options is None:
|
|
33
35
|
self.options: DevCycleLocalOptions = DevCycleLocalOptions()
|
|
@@ -45,7 +47,7 @@ class DevCycleLocalClient(AbstractDevCycleClient):
|
|
|
45
47
|
sdk_key, self.options, self.local_bucketing
|
|
46
48
|
)
|
|
47
49
|
self.event_queue_manager: EventQueueManager = EventQueueManager(
|
|
48
|
-
sdk_key, self.options, self.local_bucketing
|
|
50
|
+
sdk_key, self.client_uuid, self.options, self.local_bucketing
|
|
49
51
|
)
|
|
50
52
|
|
|
51
53
|
self._openfeature_provider = DevCycleProvider(self)
|
|
@@ -31,6 +31,7 @@ class EventQueueManager(threading.Thread):
|
|
|
31
31
|
def __init__(
|
|
32
32
|
self,
|
|
33
33
|
sdk_key: str,
|
|
34
|
+
client_uuid: str,
|
|
34
35
|
options: DevCycleLocalOptions,
|
|
35
36
|
local_bucketing: LocalBucketing,
|
|
36
37
|
):
|
|
@@ -49,7 +50,7 @@ class EventQueueManager(threading.Thread):
|
|
|
49
50
|
|
|
50
51
|
# Setup the event queue inside the WASM module
|
|
51
52
|
event_options_json = json.dumps(self._options.event_queue_options())
|
|
52
|
-
self._local_bucketing.init_event_queue(event_options_json)
|
|
53
|
+
self._local_bucketing.init_event_queue(client_uuid, event_options_json)
|
|
53
54
|
|
|
54
55
|
# Only start event processing thread if event logging is enabled
|
|
55
56
|
if not (
|
{devcycle_python_server_sdk-3.6.0.dist-info → devcycle_python_server_sdk-3.7.0.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: devcycle-python-server-sdk
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.7.0
|
|
4
4
|
Summary: DevCycle Python SDK
|
|
5
5
|
Home-page: https://github.com/devcycleHQ/python-server-sdk
|
|
6
6
|
Author: UNKNOWN
|
|
@@ -8,12 +8,12 @@ Author-email: UNKNOWN
|
|
|
8
8
|
License: UNKNOWN
|
|
9
9
|
Keywords: DevCycle
|
|
10
10
|
Platform: UNKNOWN
|
|
11
|
-
Requires-Dist: setuptools
|
|
12
|
-
Requires-Dist: urllib3
|
|
13
|
-
Requires-Dist: requests
|
|
14
|
-
Requires-Dist: wasmtime
|
|
15
|
-
Requires-Dist: protobuf
|
|
16
|
-
Requires-Dist: openfeature-sdk
|
|
11
|
+
Requires-Dist: setuptools>=21.0.0
|
|
12
|
+
Requires-Dist: urllib3>=1.15.1
|
|
13
|
+
Requires-Dist: requests~=2.31
|
|
14
|
+
Requires-Dist: wasmtime==23.0.0
|
|
15
|
+
Requires-Dist: protobuf>=4.23.3
|
|
16
|
+
Requires-Dist: openfeature-sdk>=0.7.0
|
|
17
17
|
|
|
18
18
|
The DevCycle Python SDK used for feature management.
|
|
19
19
|
|
{devcycle_python_server_sdk-3.6.0.dist-info → devcycle_python_server_sdk-3.7.0.dist-info}/RECORD
RENAMED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
devcycle_python_sdk/VERSION.txt,sha256=
|
|
1
|
+
devcycle_python_sdk/VERSION.txt,sha256=hHRrIKOnL2_4WmKXBuUFB8G9IAkHRWt23YCKKlyg77o,6
|
|
2
2
|
devcycle_python_sdk/__init__.py,sha256=30TcYb9PbvVi97gwk16omCGG1UoUI9lmmU7xpvxNMvc,336
|
|
3
|
-
devcycle_python_sdk/bucketing-lib.release.wasm,sha256=
|
|
3
|
+
devcycle_python_sdk/bucketing-lib.release.wasm,sha256=AJyYTuQs-PRjAiH9yzSgn-iESa9W7Vu0AQHLJHC5QS0,214842
|
|
4
4
|
devcycle_python_sdk/cloud_client.py,sha256=UMfXvXwO4v3pZW9ZA52ivxPH1Lp4Goy5gpV_s0qCpxQ,7352
|
|
5
5
|
devcycle_python_sdk/devcycle_client.py,sha256=W5MeOslkXjTqZtoSy_Bbbug8gVoicjxshpKjDteEr6E,917
|
|
6
6
|
devcycle_python_sdk/exceptions.py,sha256=Et7fS8pEFbHkFY86T2pJoEUstwjh4_rzhJxVH8fzAns,1053
|
|
7
|
-
devcycle_python_sdk/local_client.py,sha256=
|
|
7
|
+
devcycle_python_sdk/local_client.py,sha256=WeXt-gWhFsaPjAp2UEmygQhzx_ygx2Jaq0z0yRHaah0,9448
|
|
8
8
|
devcycle_python_sdk/options.py,sha256=Ejr6HbdyqzZajFVkEqWLk5XLfdtqCIkvsyWaRt_lgwU,4575
|
|
9
9
|
devcycle_python_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
devcycle_python_sdk/api/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
11
11
|
devcycle_python_sdk/api/backoff.py,sha256=F6WYCloaZD9CjNu6mKBMq7K20S8-i2WVU6X05ZRoawE,303
|
|
12
12
|
devcycle_python_sdk/api/bucketing_client.py,sha256=-S0y9uAffippCTfjYgxI5j4j7YNfMxQJYUba1219nps,5111
|
|
13
|
-
devcycle_python_sdk/api/config_client.py,sha256=
|
|
13
|
+
devcycle_python_sdk/api/config_client.py,sha256=73aQAq130rTHpQrVDX6n_DwFKz0WuKxRoLDiE3vSoAM,5077
|
|
14
14
|
devcycle_python_sdk/api/event_client.py,sha256=WxkuV6geEC9MgG4FN36HeEQQa22ilq2mkOVMZkpiEk4,3356
|
|
15
|
-
devcycle_python_sdk/api/local_bucketing.py,sha256
|
|
15
|
+
devcycle_python_sdk/api/local_bucketing.py,sha256=_MAMCHviIS1n4GiU-CnnLBeEVX8BUFRqwNbA1IQi84U,16470
|
|
16
16
|
devcycle_python_sdk/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
devcycle_python_sdk/managers/config_manager.py,sha256=YfgGKW4mtMhqdwWZiZ_Y67AYLC9VTpTjYhpDgfGFA4g,3599
|
|
18
|
-
devcycle_python_sdk/managers/event_queue_manager.py,sha256=
|
|
18
|
+
devcycle_python_sdk/managers/event_queue_manager.py,sha256=uPy1vO6OAisZjUNAhWELE_g17alTiOcPv42z-WwkGck,8110
|
|
19
19
|
devcycle_python_sdk/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
devcycle_python_sdk/models/bucketed_config.py,sha256=NsdT-6RbEuDy5QuK5qlr6UqNKQQnwjoXVYN-uQp0P-E,3999
|
|
21
21
|
devcycle_python_sdk/models/error_response.py,sha256=r_dRUDAbral9UGaMYcnBsZOr9Hmkyi1SQbhGmZilgpA,442
|
|
@@ -38,29 +38,29 @@ example/local_bucketing_client_example.py,sha256=TaIfy3VnW9fXii9NPYs5UOuP4fLKruX
|
|
|
38
38
|
example/openfeature_example.py,sha256=kO6F-Xk20l6CPiMfIxSRreshEGmHMFHRg3zbeLXa3AI,2410
|
|
39
39
|
test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
40
|
test/test_cloud_client.py,sha256=zjk302m7qKMCQryolkc1WKLFmbGWUxA0VtHlZk0rY-0,11442
|
|
41
|
-
test/test_local_client.py,sha256=
|
|
41
|
+
test/test_local_client.py,sha256=kDB5-cPJGyQtVdHV4MUM-CBBeOpN-oScr6I0OuyGPmE,13022
|
|
42
42
|
test/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
43
|
test/api/test_bucketing_client.py,sha256=M2mjACowLvbsIjXdP-w8-fwY02xqv1X1r_h9v-pXa7A,7739
|
|
44
|
-
test/api/test_config_client.py,sha256=
|
|
44
|
+
test/api/test_config_client.py,sha256=3BwMm4y-4NQcdW2DDGppoJLIF-ffgjlUJti2Qjw1D1M,5129
|
|
45
45
|
test/api/test_event_client.py,sha256=v4Xoum-PdywfczrfMV1llM5vrIJoqHybzxPLVokh09g,3310
|
|
46
|
-
test/api/test_local_bucketing.py,sha256=
|
|
46
|
+
test/api/test_local_bucketing.py,sha256=0mReZ4bsFUoJWPAIcQrWXDZ9UoC5mF9MuI-9BVB6qjM,15561
|
|
47
47
|
test/fixture/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
48
|
test/fixture/data.py,sha256=6ReLxWPMhCDbJ5Ex24_iR0PJNjKzPFV1I9j_v0FVbBU,1462
|
|
49
49
|
test/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
50
|
test/managers/test_config_manager.py,sha256=X0DxzWdjkvkUmarJSgzTDvO2Ma0TU6RNwL0WUwX2uA8,5963
|
|
51
|
-
test/managers/test_event_queue_manager.py,sha256=
|
|
51
|
+
test/managers/test_event_queue_manager.py,sha256=z850atk8zAlD7sYaA1OJwgCFcfC0ps4NEk4XUnNCq1U,11629
|
|
52
52
|
test/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
53
|
test/models/test_bucketed_config.py,sha256=8wCEyxaHxY21nl7ZbiFzp-IzZQBZIPIVPPzeREjumQk,858
|
|
54
54
|
test/models/test_user.py,sha256=ZNTBSKLDrqrsqZuaw5AHtc_FW4empSTaeNPZHZaFlI4,6736
|
|
55
55
|
test/openfeature_test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
56
56
|
test/openfeature_test/test_provider.py,sha256=UPxAD5e7NvpIhmqNFCrTY_yrKrMyYxBc2xuMAgdSGvw,7653
|
|
57
|
-
test/openfeature_test/test_provider_local_sdk.py,sha256=
|
|
57
|
+
test/openfeature_test/test_provider_local_sdk.py,sha256=ad0QizKSS-lbqlIjiQvwtKHP7PCFfYam3OKHtvsFBkU,4426
|
|
58
58
|
test/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
59
59
|
test/util/test_strings.py,sha256=T5H5U0af7_ld1yJC8IdDmay_Mx-iJQ5Fi5fbvKcAc7A,862
|
|
60
60
|
test/util/test_utils.py,sha256=tVBJm_qnqg-4PssLpXIxqlk0JehuiAIPs4zpi2oNVnY,6671
|
|
61
61
|
test/util/test_version.py,sha256=3Xg0_84m0bdHXz6pxd2Z85Oz9DoUC1T0Ol_WqEH_jac,335
|
|
62
|
-
devcycle_python_server_sdk-3.
|
|
63
|
-
devcycle_python_server_sdk-3.
|
|
64
|
-
devcycle_python_server_sdk-3.
|
|
65
|
-
devcycle_python_server_sdk-3.
|
|
66
|
-
devcycle_python_server_sdk-3.
|
|
62
|
+
devcycle_python_server_sdk-3.7.0.dist-info/LICENSE,sha256=tHQMqu-Jic2UpMGqb-vNFbGygysl8IG4l1clnnh0OFo,1071
|
|
63
|
+
devcycle_python_server_sdk-3.7.0.dist-info/METADATA,sha256=_-YyCxkWszSUSrrSonIq-r9mkx-AqA3KiCAy1MRRuec,503
|
|
64
|
+
devcycle_python_server_sdk-3.7.0.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
65
|
+
devcycle_python_server_sdk-3.7.0.dist-info/top_level.txt,sha256=34f8zDzihAHoH7siAFlmscyO_QLNWWq9HApFlwtYL4k,33
|
|
66
|
+
devcycle_python_server_sdk-3.7.0.dist-info/RECORD,,
|
test/api/test_config_client.py
CHANGED
test/api/test_local_bucketing.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
3
|
import unittest
|
|
4
|
+
import uuid
|
|
4
5
|
|
|
5
6
|
from devcycle_python_sdk.api.local_bucketing import LocalBucketing, WASMAbortError
|
|
6
7
|
from devcycle_python_sdk.models.bucketed_config import (
|
|
@@ -24,6 +25,7 @@ class LocalBucketingTest(unittest.TestCase):
|
|
|
24
25
|
def setUp(self) -> None:
|
|
25
26
|
self.test_sdk_key = "dvc_server_testkey"
|
|
26
27
|
self.local_bucketing = LocalBucketing(self.test_sdk_key)
|
|
28
|
+
self.client_uuid = str(uuid.uuid4())
|
|
27
29
|
|
|
28
30
|
def test_init(self):
|
|
29
31
|
local_bucketing = LocalBucketing(self.test_sdk_key)
|
|
@@ -93,7 +95,7 @@ class LocalBucketingTest(unittest.TestCase):
|
|
|
93
95
|
self.local_bucketing.store_config(small_config())
|
|
94
96
|
platform_json = json.dumps(default_platform_data().to_json())
|
|
95
97
|
self.local_bucketing.set_platform_data(platform_json)
|
|
96
|
-
self.local_bucketing.init_event_queue("{}")
|
|
98
|
+
self.local_bucketing.init_event_queue(self.client_uuid, "{}")
|
|
97
99
|
user = DevCycleUser(user_id="test_user_id")
|
|
98
100
|
result = self.local_bucketing.get_variable_for_user_protobuf(
|
|
99
101
|
user=user, key="string-var", default_value="default value"
|
|
@@ -108,7 +110,7 @@ class LocalBucketingTest(unittest.TestCase):
|
|
|
108
110
|
self.local_bucketing.store_config(special_character_config())
|
|
109
111
|
platform_json = json.dumps(default_platform_data().to_json())
|
|
110
112
|
self.local_bucketing.set_platform_data(platform_json)
|
|
111
|
-
self.local_bucketing.init_event_queue("{}")
|
|
113
|
+
self.local_bucketing.init_event_queue(self.client_uuid, "{}")
|
|
112
114
|
user = DevCycleUser(user_id="test_user_id")
|
|
113
115
|
result = self.local_bucketing.get_variable_for_user_protobuf(
|
|
114
116
|
user=user, key="string-var", default_value="default value"
|
|
@@ -123,7 +125,7 @@ class LocalBucketingTest(unittest.TestCase):
|
|
|
123
125
|
self.local_bucketing.store_config(small_config())
|
|
124
126
|
platform_json = json.dumps(default_platform_data().to_json())
|
|
125
127
|
self.local_bucketing.set_platform_data(platform_json)
|
|
126
|
-
self.local_bucketing.init_event_queue("{}")
|
|
128
|
+
self.local_bucketing.init_event_queue(self.client_uuid, "{}")
|
|
127
129
|
user = DevCycleUser(user_id="test_user_id")
|
|
128
130
|
|
|
129
131
|
# type mismatch is handled inside the WASM and will return
|
|
@@ -137,7 +139,7 @@ class LocalBucketingTest(unittest.TestCase):
|
|
|
137
139
|
self.local_bucketing.store_config(small_config())
|
|
138
140
|
platform_json = json.dumps(default_platform_data().to_json())
|
|
139
141
|
self.local_bucketing.set_platform_data(platform_json)
|
|
140
|
-
self.local_bucketing.init_event_queue("{}")
|
|
142
|
+
self.local_bucketing.init_event_queue(self.client_uuid, "{}")
|
|
141
143
|
user = DevCycleUser(user_id="test_user_id")
|
|
142
144
|
|
|
143
145
|
result = self.local_bucketing.generate_bucketed_config(user=user)
|
|
@@ -265,7 +267,7 @@ class LocalBucketingTest(unittest.TestCase):
|
|
|
265
267
|
self.local_bucketing.store_config(small_config())
|
|
266
268
|
platform_json = json.dumps(default_platform_data().to_json())
|
|
267
269
|
self.local_bucketing.set_platform_data(platform_json)
|
|
268
|
-
self.local_bucketing.init_event_queue("{}")
|
|
270
|
+
self.local_bucketing.init_event_queue(self.client_uuid, "{}")
|
|
269
271
|
|
|
270
272
|
result = self.local_bucketing.get_event_queue_size()
|
|
271
273
|
self.assertEqual(result, 0)
|
|
@@ -276,13 +278,14 @@ class LocalBucketingTest(unittest.TestCase):
|
|
|
276
278
|
self.local_bucketing.set_platform_data(platform_json)
|
|
277
279
|
|
|
278
280
|
self.local_bucketing.init_event_queue(
|
|
281
|
+
self.client_uuid,
|
|
279
282
|
json.dumps(
|
|
280
283
|
{
|
|
281
284
|
"disableAutomaticEventLogging": False,
|
|
282
285
|
"disableCustomEventLogging": False,
|
|
283
286
|
"minEventsPerFlush": 1,
|
|
284
287
|
}
|
|
285
|
-
)
|
|
288
|
+
),
|
|
286
289
|
)
|
|
287
290
|
results = self.local_bucketing.flush_event_queue()
|
|
288
291
|
self.assertIsNotNone(results)
|
|
@@ -294,13 +297,14 @@ class LocalBucketingTest(unittest.TestCase):
|
|
|
294
297
|
self.local_bucketing.set_platform_data(platform_json)
|
|
295
298
|
|
|
296
299
|
self.local_bucketing.init_event_queue(
|
|
300
|
+
self.client_uuid,
|
|
297
301
|
json.dumps(
|
|
298
302
|
{
|
|
299
303
|
"disableAutomaticEventLogging": False,
|
|
300
304
|
"disableCustomEventLogging": False,
|
|
301
305
|
"minEventsPerFlush": 1,
|
|
302
306
|
}
|
|
303
|
-
)
|
|
307
|
+
),
|
|
304
308
|
)
|
|
305
309
|
|
|
306
310
|
# trigger two events for a single user
|
|
@@ -326,13 +330,14 @@ class LocalBucketingTest(unittest.TestCase):
|
|
|
326
330
|
self.local_bucketing.set_platform_data(platform_json)
|
|
327
331
|
|
|
328
332
|
self.local_bucketing.init_event_queue(
|
|
333
|
+
self.client_uuid,
|
|
329
334
|
json.dumps(
|
|
330
335
|
{
|
|
331
336
|
"disableAutomaticEventLogging": False,
|
|
332
337
|
"disableCustomEventLogging": False,
|
|
333
338
|
"minEventsPerFlush": 1,
|
|
334
339
|
}
|
|
335
|
-
)
|
|
340
|
+
),
|
|
336
341
|
)
|
|
337
342
|
|
|
338
343
|
with self.assertRaises(WASMAbortError):
|
|
@@ -344,13 +349,14 @@ class LocalBucketingTest(unittest.TestCase):
|
|
|
344
349
|
self.local_bucketing.set_platform_data(platform_json)
|
|
345
350
|
|
|
346
351
|
self.local_bucketing.init_event_queue(
|
|
352
|
+
self.client_uuid,
|
|
347
353
|
json.dumps(
|
|
348
354
|
{
|
|
349
355
|
"disableAutomaticEventLogging": False,
|
|
350
356
|
"disableCustomEventLogging": False,
|
|
351
357
|
"minEventsPerFlush": 1,
|
|
352
358
|
}
|
|
353
|
-
)
|
|
359
|
+
),
|
|
354
360
|
)
|
|
355
361
|
|
|
356
362
|
with self.assertRaises(WASMAbortError):
|
|
@@ -360,7 +366,7 @@ class LocalBucketingTest(unittest.TestCase):
|
|
|
360
366
|
self.local_bucketing.store_config(small_config())
|
|
361
367
|
platform_json = json.dumps(default_platform_data().to_json())
|
|
362
368
|
self.local_bucketing.set_platform_data(platform_json)
|
|
363
|
-
self.local_bucketing.init_event_queue("{}")
|
|
369
|
+
self.local_bucketing.init_event_queue(self.client_uuid, "{}")
|
|
364
370
|
user = DevCycleUser(user_id="test_user_id")
|
|
365
371
|
event = DevCycleEvent(
|
|
366
372
|
type=EventType.CustomEvent,
|
|
@@ -376,7 +382,7 @@ class LocalBucketingTest(unittest.TestCase):
|
|
|
376
382
|
self.local_bucketing.store_config(small_config())
|
|
377
383
|
platform_json = json.dumps(default_platform_data().to_json())
|
|
378
384
|
self.local_bucketing.set_platform_data(platform_json)
|
|
379
|
-
self.local_bucketing.init_event_queue("{}")
|
|
385
|
+
self.local_bucketing.init_event_queue(self.client_uuid, "{}")
|
|
380
386
|
|
|
381
387
|
event = DevCycleEvent(
|
|
382
388
|
type=EventType.AggVariableDefaulted,
|
|
@@ -26,6 +26,7 @@ logger = logging.getLogger(__name__)
|
|
|
26
26
|
class EventQueueManagerTest(unittest.TestCase):
|
|
27
27
|
def setUp(self) -> None:
|
|
28
28
|
self.sdk_key = "dvc_server_" + str(uuid.uuid4())
|
|
29
|
+
self.client_uuid = str(uuid.uuid4())
|
|
29
30
|
|
|
30
31
|
# mock out the local bucketing to test event queue logic directly
|
|
31
32
|
self.test_local_bucketing = MagicMock()
|
|
@@ -84,7 +85,7 @@ class EventQueueManagerTest(unittest.TestCase):
|
|
|
84
85
|
self.test_local_bucketing.flush_event_queue.return_value = []
|
|
85
86
|
self.test_options.event_flush_interval_ms = 100
|
|
86
87
|
manager = EventQueueManager(
|
|
87
|
-
self.sdk_key, self.test_options, self.test_local_bucketing
|
|
88
|
+
self.sdk_key, self.client_uuid, self.test_options, self.test_local_bucketing
|
|
88
89
|
)
|
|
89
90
|
self.assertTrue(manager._should_run())
|
|
90
91
|
self.assertTrue(manager.is_alive())
|
|
@@ -94,7 +95,7 @@ class EventQueueManagerTest(unittest.TestCase):
|
|
|
94
95
|
self.test_local_bucketing.flush_event_queue.return_value = []
|
|
95
96
|
self.test_options.event_flush_interval_ms = 100
|
|
96
97
|
manager = EventQueueManager(
|
|
97
|
-
self.sdk_key, self.test_options, self.test_local_bucketing
|
|
98
|
+
self.sdk_key, self.client_uuid, self.test_options, self.test_local_bucketing
|
|
98
99
|
)
|
|
99
100
|
|
|
100
101
|
manager.close()
|
|
@@ -111,7 +112,10 @@ class EventQueueManagerTest(unittest.TestCase):
|
|
|
111
112
|
mock_publish_events.side_effect = APIClientError("Some retryable error")
|
|
112
113
|
|
|
113
114
|
manager = EventQueueManager(
|
|
114
|
-
self.sdk_key,
|
|
115
|
+
self.sdk_key,
|
|
116
|
+
self.client_uuid,
|
|
117
|
+
self.test_options_no_thread,
|
|
118
|
+
self.test_local_bucketing,
|
|
115
119
|
)
|
|
116
120
|
manager._publish_event_payload(self.test_payload)
|
|
117
121
|
|
|
@@ -129,7 +133,10 @@ class EventQueueManagerTest(unittest.TestCase):
|
|
|
129
133
|
)
|
|
130
134
|
|
|
131
135
|
manager = EventQueueManager(
|
|
132
|
-
self.sdk_key,
|
|
136
|
+
self.sdk_key,
|
|
137
|
+
self.client_uuid,
|
|
138
|
+
self.test_options_no_thread,
|
|
139
|
+
self.test_local_bucketing,
|
|
133
140
|
)
|
|
134
141
|
manager._publish_event_payload(self.test_payload)
|
|
135
142
|
|
|
@@ -146,7 +153,10 @@ class EventQueueManagerTest(unittest.TestCase):
|
|
|
146
153
|
self.test_local_bucketing.flush_event_queue.return_value = []
|
|
147
154
|
|
|
148
155
|
manager = EventQueueManager(
|
|
149
|
-
self.sdk_key,
|
|
156
|
+
self.sdk_key,
|
|
157
|
+
self.client_uuid,
|
|
158
|
+
self.test_options_no_thread,
|
|
159
|
+
self.test_local_bucketing,
|
|
150
160
|
)
|
|
151
161
|
manager._flush_events()
|
|
152
162
|
|
|
@@ -158,7 +168,10 @@ class EventQueueManagerTest(unittest.TestCase):
|
|
|
158
168
|
self.test_local_bucketing.flush_event_queue.return_value = [self.test_payload]
|
|
159
169
|
|
|
160
170
|
manager = EventQueueManager(
|
|
161
|
-
self.sdk_key,
|
|
171
|
+
self.sdk_key,
|
|
172
|
+
self.client_uuid,
|
|
173
|
+
self.test_options_no_thread,
|
|
174
|
+
self.test_local_bucketing,
|
|
162
175
|
)
|
|
163
176
|
result = manager._flush_events()
|
|
164
177
|
|
|
@@ -169,7 +182,10 @@ class EventQueueManagerTest(unittest.TestCase):
|
|
|
169
182
|
|
|
170
183
|
def test_queue_event_bad_data(self):
|
|
171
184
|
manager = EventQueueManager(
|
|
172
|
-
self.sdk_key,
|
|
185
|
+
self.sdk_key,
|
|
186
|
+
self.client_uuid,
|
|
187
|
+
self.test_options_no_thread,
|
|
188
|
+
self.test_local_bucketing,
|
|
173
189
|
)
|
|
174
190
|
with self.assertRaises(ValueError):
|
|
175
191
|
manager.queue_event(user=None, event=None)
|
|
@@ -188,7 +204,10 @@ class EventQueueManagerTest(unittest.TestCase):
|
|
|
188
204
|
self.test_local_bucketing.get_event_queue_size.return_value = 1
|
|
189
205
|
|
|
190
206
|
manager = EventQueueManager(
|
|
191
|
-
self.sdk_key,
|
|
207
|
+
self.sdk_key,
|
|
208
|
+
self.client_uuid,
|
|
209
|
+
self.test_options_no_thread,
|
|
210
|
+
self.test_local_bucketing,
|
|
192
211
|
)
|
|
193
212
|
DevCycleUser(user_id="test_user_id")
|
|
194
213
|
event = DevCycleEvent(
|
|
@@ -207,7 +226,10 @@ class EventQueueManagerTest(unittest.TestCase):
|
|
|
207
226
|
self.test_options_no_thread.max_event_queue_size = 100
|
|
208
227
|
|
|
209
228
|
manager = EventQueueManager(
|
|
210
|
-
self.sdk_key,
|
|
229
|
+
self.sdk_key,
|
|
230
|
+
self.client_uuid,
|
|
231
|
+
self.test_options_no_thread,
|
|
232
|
+
self.test_local_bucketing,
|
|
211
233
|
)
|
|
212
234
|
|
|
213
235
|
# queue empty, no issues
|
|
@@ -231,7 +253,10 @@ class EventQueueManagerTest(unittest.TestCase):
|
|
|
231
253
|
|
|
232
254
|
def test_queue_aggregate_event_bad_data(self):
|
|
233
255
|
manager = EventQueueManager(
|
|
234
|
-
self.sdk_key,
|
|
256
|
+
self.sdk_key,
|
|
257
|
+
self.client_uuid,
|
|
258
|
+
self.test_options_no_thread,
|
|
259
|
+
self.test_local_bucketing,
|
|
235
260
|
)
|
|
236
261
|
with self.assertRaises(ValueError):
|
|
237
262
|
manager.queue_aggregate_event(event=None, bucketed_config=None)
|
|
@@ -252,7 +277,10 @@ class EventQueueManagerTest(unittest.TestCase):
|
|
|
252
277
|
self.test_local_bucketing.get_event_queue_size.return_value = 1
|
|
253
278
|
|
|
254
279
|
manager = EventQueueManager(
|
|
255
|
-
self.sdk_key,
|
|
280
|
+
self.sdk_key,
|
|
281
|
+
self.client_uuid,
|
|
282
|
+
self.test_options_no_thread,
|
|
283
|
+
self.test_local_bucketing,
|
|
256
284
|
)
|
|
257
285
|
event = DevCycleEvent(
|
|
258
286
|
type=EventType.AggVariableDefaulted,
|
|
@@ -23,7 +23,7 @@ class DevCycleProviderWithLocalSDKTest(unittest.TestCase):
|
|
|
23
23
|
self.test_config_json = small_config_json()
|
|
24
24
|
self.test_etag = "2f71454e-3279-4ca7-a8e7-802ce97bef43"
|
|
25
25
|
|
|
26
|
-
config_url = "http://localhost/config/
|
|
26
|
+
config_url = "http://localhost/config/v2/server/" + self.sdk_key + ".json"
|
|
27
27
|
|
|
28
28
|
responses.add(
|
|
29
29
|
responses.GET,
|
test/test_local_client.py
CHANGED
|
@@ -25,7 +25,7 @@ class DevCycleLocalClientTest(unittest.TestCase):
|
|
|
25
25
|
self.test_config_json = small_config_json()
|
|
26
26
|
self.test_etag = "2f71454e-3279-4ca7-a8e7-802ce97bef43"
|
|
27
27
|
|
|
28
|
-
config_url = "http://localhost/config/
|
|
28
|
+
config_url = "http://localhost/config/v2/server/" + self.sdk_key + ".json"
|
|
29
29
|
|
|
30
30
|
responses.add(
|
|
31
31
|
responses.GET,
|
|
@@ -371,7 +371,7 @@ def test_benchmark_variable_call(benchmark):
|
|
|
371
371
|
test_config_json = small_config_json()
|
|
372
372
|
test_etag = "2f71454e-3279-4ca7-a8e7-802ce97bef43"
|
|
373
373
|
|
|
374
|
-
config_url = "http://localhost/config/
|
|
374
|
+
config_url = "http://localhost/config/v2/server/" + sdk_key + ".json"
|
|
375
375
|
|
|
376
376
|
responses.add(
|
|
377
377
|
responses.GET,
|
{devcycle_python_server_sdk-3.6.0.dist-info → devcycle_python_server_sdk-3.7.0.dist-info}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|