Skip to content

Commit 4b4e994

Browse files
committed
debugging test
1 parent c2ed3a3 commit 4b4e994

File tree

1 file changed

+43
-48
lines changed

1 file changed

+43
-48
lines changed

tests/integration/test_client_e2e.py

Lines changed: 43 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -943,54 +943,6 @@ def setup_method(self):
943943
class LocalhostIntegrationTests(object): # pylint: disable=too-few-public-methods
944944
"""Client & Manager integration tests."""
945945

946-
def test_incorrect_file_e2e(self):
947-
factory = get_factory('localhost', config={'splitFile': 'filename'})
948-
exception_raised = False
949-
try:
950-
factory.block_until_ready(1)
951-
except TimeoutException as e:
952-
exception_raised = True
953-
954-
assert(exception_raised)
955-
956-
event = threading.Event()
957-
factory.destroy(event)
958-
event.wait()
959-
960-
def test_localhost_e2e(self):
961-
"""Instantiate a client with a YAML file and issue get_treatment() calls."""
962-
filename = os.path.join(os.path.dirname(__file__), 'files', 'file2.yaml')
963-
factory = get_factory('localhost', config={'splitFile': filename})
964-
factory.block_until_ready()
965-
client = factory.client()
966-
assert client.get_treatment_with_config('key', 'my_feature') == ('on', '{"desc" : "this applies only to ON treatment"}')
967-
assert client.get_treatment_with_config('only_key', 'my_feature') == (
968-
'off', '{"desc" : "this applies only to OFF and only for only_key. The rest will receive ON"}'
969-
)
970-
assert client.get_treatment_with_config('another_key', 'my_feature') == ('control', None)
971-
assert client.get_treatment_with_config('key2', 'other_feature') == ('on', None)
972-
assert client.get_treatment_with_config('key3', 'other_feature') == ('on', None)
973-
assert client.get_treatment_with_config('some_key', 'other_feature_2') == ('on', None)
974-
assert client.get_treatment_with_config('key_whitelist', 'other_feature_3') == ('on', None)
975-
assert client.get_treatment_with_config('any_other_key', 'other_feature_3') == ('off', None)
976-
977-
manager = factory.manager()
978-
assert manager.split('my_feature').configs == {
979-
'on': '{"desc" : "this applies only to ON treatment"}',
980-
'off': '{"desc" : "this applies only to OFF and only for only_key. The rest will receive ON"}'
981-
}
982-
assert manager.split('other_feature').configs == {}
983-
assert manager.split('other_feature_2').configs == {}
984-
assert manager.split('other_feature_3').configs == {}
985-
event = threading.Event()
986-
factory.destroy(event)
987-
event.wait()
988-
989-
# hack to increase isolation and prevent conflicts with other tests
990-
# thread = factory._sync_manager._synchronizer._split_tasks.split_task._task._thread
991-
# if thread is not None and thread.is_alive():
992-
# thread.join()
993-
994946
def test_localhost_json_e2e(self):
995947
"""Instantiate a client with a JSON file and issue get_treatment() calls."""
996948
filename = os.path.join(os.path.dirname(__file__), 'files', 'split_changes_temp.json')
@@ -1118,3 +1070,46 @@ def _synchronize_now(self):
11181070
filename = os.path.join(os.path.dirname(__file__), 'files', 'split_changes_temp.json')
11191071
self.factory._sync_manager._synchronizer._split_synchronizers._split_sync._filename = filename
11201072
self.factory._sync_manager._synchronizer._split_synchronizers._split_sync.synchronize_splits()
1073+
1074+
def test_incorrect_file_e2e(self):
1075+
factory = get_factory('localhost', config={'splitFile': 'filename'})
1076+
exception_raised = False
1077+
try:
1078+
factory.block_until_ready(1)
1079+
except TimeoutException as e:
1080+
exception_raised = True
1081+
1082+
assert(exception_raised)
1083+
1084+
event = threading.Event()
1085+
factory.destroy(event)
1086+
event.wait()
1087+
1088+
def test_localhost_e2e(self):
1089+
"""Instantiate a client with a YAML file and issue get_treatment() calls."""
1090+
filename = os.path.join(os.path.dirname(__file__), 'files', 'file2.yaml')
1091+
factory = get_factory('localhost', config={'splitFile': filename})
1092+
factory.block_until_ready()
1093+
client = factory.client()
1094+
assert client.get_treatment_with_config('key', 'my_feature') == ('on', '{"desc" : "this applies only to ON treatment"}')
1095+
assert client.get_treatment_with_config('only_key', 'my_feature') == (
1096+
'off', '{"desc" : "this applies only to OFF and only for only_key. The rest will receive ON"}'
1097+
)
1098+
assert client.get_treatment_with_config('another_key', 'my_feature') == ('control', None)
1099+
assert client.get_treatment_with_config('key2', 'other_feature') == ('on', None)
1100+
assert client.get_treatment_with_config('key3', 'other_feature') == ('on', None)
1101+
assert client.get_treatment_with_config('some_key', 'other_feature_2') == ('on', None)
1102+
assert client.get_treatment_with_config('key_whitelist', 'other_feature_3') == ('on', None)
1103+
assert client.get_treatment_with_config('any_other_key', 'other_feature_3') == ('off', None)
1104+
1105+
manager = factory.manager()
1106+
assert manager.split('my_feature').configs == {
1107+
'on': '{"desc" : "this applies only to ON treatment"}',
1108+
'off': '{"desc" : "this applies only to OFF and only for only_key. The rest will receive ON"}'
1109+
}
1110+
assert manager.split('other_feature').configs == {}
1111+
assert manager.split('other_feature_2').configs == {}
1112+
assert manager.split('other_feature_3').configs == {}
1113+
event = threading.Event()
1114+
factory.destroy(event)
1115+
event.wait()

0 commit comments

Comments
 (0)