diff --git a/Python/stress-testing/channel.py b/Python/stress-testing/channel.py index 273f6137e3c768670ac3b5f0042cb3b49154ef4b..4e51ef2879436347fbd260ba0337ec87f080b48a 100644 --- a/Python/stress-testing/channel.py +++ b/Python/stress-testing/channel.py @@ -43,8 +43,8 @@ def add_user_to_channel(channel_id, username): data = { 'username': username } r = requests.put(Config.BACKEND_URL + '/channels/' + channel_id + '/members', json=data, headers=Config.HEADER(), verify=Config.VERIFY) if r.status_code != requests.codes.ok: - print('error updating channel', r.json()) - sys.exit(2) + #print('error updating channel', r.json()) + raise FileExistsError("add_user_to_channel", r.json()) updated_channel = r.json() return updated_channel['id'] @@ -55,8 +55,8 @@ def add_group_to_channel(channel_id, group): data = { 'group': { 'groupIdentifier': group } } r = requests.put(Config.BACKEND_URL + '/channels/' + channel_id + '/groups', json=data, headers=Config.HEADER(), verify=Config.VERIFY) if r.status_code != requests.codes.ok: - print('error updating channel', r.json()) - sys.exit(2) + #print('error updating channel', r.json()) + raise FileExistsError("add_group_to_channel", r.json()) updated_channel = r.json() return updated_channel['id'] diff --git a/Python/stress-testing/stress_testing.py b/Python/stress-testing/stress_testing.py index 195512afed29dd51d83a7eae2d75d989cb3a8ff0..674c6b329a679eab2aa6640ebc5702901891c3c7 100644 --- a/Python/stress-testing/stress_testing.py +++ b/Python/stress-testing/stress_testing.py @@ -103,8 +103,10 @@ def main(argv): for ucpt in range(0, countusers): if (int(ucpt / 10)) != (cnt % len(Config.NOTIFTEST_GROUPS)): add_user_to_channel(channel_id, Config.NOTIFTEST_USERS[ucpt]) - except Exception: - print('error adding, skipping.') + except FileExistsError as ex: + print("\tGroup or Member already exists") + pass + # Add probeXXX users as member #for username in Config.PROBE_USERS: # add_user_to_channel(channel_id, username)