diff --git a/stackalytics/dashboard/templates/_macros/user_profile.html b/stackalytics/dashboard/templates/_macros/user_profile.html index 4f1ab066e..78cb4f166 100644 --- a/stackalytics/dashboard/templates/_macros/user_profile.html +++ b/stackalytics/dashboard/templates/_macros/user_profile.html @@ -32,8 +32,16 @@ {%if launchpad_id %}
Launchpad: ${launchpad_id}
{%/if%} - {%if gerrit_id %} -
Gerrit: ${gerrit_id}
+ {%if gerrit_ids %} +
Gerrit:
+ {%each(hostname, ids) gerrit_ids %} +
+ ${hostname}: + {%each(i, id) ids%} + ${id} + {%/each%} +
+ {%/each%} {%/if%} {%if github_id %}
Github: ${github_id}
diff --git a/stackalytics/processor/dump.py b/stackalytics/processor/dump.py index 46b211f92..227552e6a 100644 --- a/stackalytics/processor/dump.py +++ b/stackalytics/processor/dump.py @@ -139,8 +139,11 @@ def export_data(memcached_inst, fd): user), fd) if user.get('launchpad_id'): pickle.dump(('user:%s' % user['launchpad_id'], user), fd) - if user.get('gerrit_id'): - pickle.dump(('user:gerrit:%s' % user['gerrit_id'], user), fd) + for hostname, ids in user.get('gerrit_ids', {}).items(): + for gerrit_id in ids: + pickle.dump(('user:gerrit:%s:%s' % (hostname, gerrit_id), + user), + fd) if user.get('member_id'): pickle.dump(('user:member:%s' % user['member_id'], user), fd) for email in user.get('emails') or []: diff --git a/stackalytics/processor/main.py b/stackalytics/processor/main.py index 683cef316..9074bb6ce 100644 --- a/stackalytics/processor/main.py +++ b/stackalytics/processor/main.py @@ -122,6 +122,7 @@ def _process_repo_reviews(repo, runtime_storage_inst, record_processor_inst): rcs_inst.setup(key_filename=repo['key_filename'], username=repo['ssh_username'], gerrit_retry=CONF.gerrit_retry) + gerrit_hostname = rcs.get_socket_tuple_from_uri(repo['gerrit_uri'])[0] for branch in _get_repo_branches(repo): LOG.info('Processing reviews for repo: %s, branch: %s', @@ -139,7 +140,11 @@ def _process_repo_reviews(repo, runtime_storage_inst, record_processor_inst): rcs_inst.log(repo, branch, last_retrieval_time, status='abandoned', grab_comments=True), ) - review_iterator_typed = _record_typer(review_iterator, 'review') + review_iterator_with_gerrit = _param_adder( + review_iterator, 'gerrit_hostname', gerrit_hostname + ) + review_iterator_typed = _record_typer(review_iterator_with_gerrit, + 'review') processed_review_iterator = record_processor_inst.process( review_iterator_typed) @@ -153,9 +158,9 @@ def _process_repo_reviews(repo, runtime_storage_inst, record_processor_inst): def _process_repo_vcs(repo, runtime_storage_inst, record_processor_inst): vcs_inst = vcs.get_vcs(repo, CONF.sources_root) vcs_inst.fetch() - gerrit_hostname, _ = rcs.get_socket_tuple_from_uri( + gerrit_hostname = rcs.get_socket_tuple_from_uri( repo.get('gerrit_uri', CONF.review_uri) - ) + )[0] for branch in _get_repo_branches(repo): LOG.info('Processing commits in repo: %s, branch: %s', diff --git a/stackalytics/processor/record_processor.py b/stackalytics/processor/record_processor.py index 56c54b4e4..682785f95 100644 --- a/stackalytics/processor/record_processor.py +++ b/stackalytics/processor/record_processor.py @@ -99,9 +99,11 @@ class RecordProcessor(object): user_name = lp_user_name gerrit_id = record.get('gerrit_id') + gerrit_tuple = None if gerrit_id: + gerrit_tuple = (record['gerrit_hostname'], gerrit_id) user_g = user_processor.load_user( - self.runtime_storage_inst, gerrit_id=gerrit_id) or {} + self.runtime_storage_inst, gerrit_tuple=gerrit_tuple) or {} if (self._need_to_fetch_launchpad() and (not user_g) and (not launchpad_id) and (not user_e.get('launchpad_id'))): # query LP @@ -135,7 +137,7 @@ class RecordProcessor(object): return user_e user = user_processor.create_user( - self.domains_index, launchpad_id, email, gerrit_id, zanata_id, + self.domains_index, launchpad_id, email, gerrit_tuple, zanata_id, user_name) if user_e or user_l or user_g or user_z: @@ -262,6 +264,7 @@ class RecordProcessor(object): or 'Anonymous Coward') if uploader.get('email'): patch_record['author_email'] = uploader['email'].lower() + patch_record['gerrit_hostname'] = review['gerrit_hostname'] patch_record['module'] = review['module'] patch_record['branch'] = review['branch'] patch_record['review_id'] = review['id'] @@ -286,6 +289,7 @@ class RecordProcessor(object): mark['branch'] = review['branch'] mark['review_id'] = review['id'] mark['patch'] = int(patch['number']) + mark['gerrit_hostname'] = review['gerrit_hostname'] if reviewer['username'] == patch['uploader'].get('username'): # reviewer is the same as author of the patch diff --git a/stackalytics/processor/user_processor.py b/stackalytics/processor/user_processor.py index 117e109ed..d4eeaae82 100644 --- a/stackalytics/processor/user_processor.py +++ b/stackalytics/processor/user_processor.py @@ -23,12 +23,12 @@ INDEPENDENT = '*independent' ROBOTS = '*robots' -def make_user_id(emails=None, launchpad_id=None, gerrit_id=None, +def make_user_id(emails=None, launchpad_id=None, gerrit_tuple=None, member_id=None, github_id=None, zanata_id=None): if launchpad_id or emails: return launchpad_id or emails[0] - if gerrit_id: - return 'gerrit:%s' % gerrit_id + if gerrit_tuple: + return 'gerrit:%s:%s' % gerrit_tuple if member_id: return 'member:%s' % member_id if github_id: @@ -48,9 +48,10 @@ def store_user(runtime_storage_inst, user): runtime_storage_inst.set_by_key('user:%s' % user['user_id'], user) if user.get('launchpad_id'): runtime_storage_inst.set_by_key('user:%s' % user['launchpad_id'], user) - if user.get('gerrit_id'): - runtime_storage_inst.set_by_key('user:gerrit:%s' % user['gerrit_id'], - user) + for hostname, ids in user.get('gerrit_ids', {}).items(): + for gerrit_id in ids: + runtime_storage_inst.set_by_key( + 'user:gerrit:%s:%s' % (hostname, gerrit_id), user) if user.get('github_id'): runtime_storage_inst.set_by_key('user:github:%s' % user['github_id'], user) @@ -62,10 +63,10 @@ def store_user(runtime_storage_inst, user): def load_user(runtime_storage_inst, seq=None, user_id=None, email=None, - launchpad_id=None, gerrit_id=None, member_id=None, + launchpad_id=None, gerrit_tuple=None, member_id=None, github_id=None, zanata_id=None): - key = make_user_id(gerrit_id=gerrit_id, member_id=member_id, + key = make_user_id(gerrit_tuple=gerrit_tuple, member_id=member_id, github_id=github_id, zanata_id=zanata_id) if not key: key = seq or user_id or launchpad_id or email @@ -85,8 +86,14 @@ def update_user_profile(stored_user, user): if stored_user: updated_user = copy.deepcopy(stored_user) updated_user.update(user) - updated_user['emails'] = list(set(stored_user.get('emails', [])) | - set(user.get('emails', []))) + updated_user['emails'] = sorted( + list(set(stored_user.get('emails', [])) | + set(user.get('emails', []))) + ) + gerrit_ids = _merge_gerrit_ids([stored_user, user]) + if gerrit_ids: + updated_user['gerrit_ids'] = gerrit_ids + else: updated_user = copy.deepcopy(user) updated_user['static'] = True @@ -123,14 +130,15 @@ def get_company_by_email(domains_index, email): return None -def create_user(domains_index, launchpad_id, email, gerrit_id, zanata_id, +def create_user(domains_index, launchpad_id, email, gerrit_tuple, zanata_id, user_name): company = get_company_by_email(domains_index, email) or INDEPENDENT emails = [email] if email else [] user = { 'user_id': make_user_id( - emails=emails, launchpad_id=launchpad_id, gerrit_id=gerrit_id, + emails=emails, launchpad_id=launchpad_id, + gerrit_tuple=gerrit_tuple, zanata_id=zanata_id), 'launchpad_id': launchpad_id, 'user_name': user_name or '', @@ -141,8 +149,10 @@ def create_user(domains_index, launchpad_id, email, gerrit_id, zanata_id, 'emails': emails, } - if gerrit_id: - user['gerrit_id'] = gerrit_id + if gerrit_tuple: + user['gerrit_ids'] = { + gerrit_tuple[0]: [gerrit_tuple[1]] + } if zanata_id: user['zanata_id'] = zanata_id @@ -170,6 +180,20 @@ def update_user_affiliation(domains_index, user): break +def _merge_gerrit_ids(users): + gerrit_ids = {} + hostnames = set() + for user in users: + hostnames.update(set(user.get('gerrit_ids', {}).keys())) + for hostname in hostnames: + ids = set() + for user in users: + ids |= set(user.get('gerrit_ids', {}).get(hostname, [])) + if ids: + gerrit_ids[hostname] = sorted(list(ids)) + return gerrit_ids + + def merge_user_profiles(domains_index, user_profiles): """Merge user profiles into one @@ -182,23 +206,18 @@ def merge_user_profiles(domains_index, user_profiles): """ LOG.debug('Merge profiles: %s', user_profiles) - # check of there are more than 1 launchpad_id nor gerrit_id + # check of there are more than 1 launchpad_id lp_ids = set(u.get('launchpad_id') for u in user_profiles if u.get('launchpad_id')) if len(lp_ids) > 1: LOG.debug('Ambiguous launchpad ids: %s on profiles: %s', lp_ids, user_profiles) - g_ids = set(u.get('gerrit_id') for u in user_profiles - if u.get('gerrit_id')) - if len(g_ids) > 1: - LOG.debug('Ambiguous gerrit ids: %s on profiles: %s', - g_ids, user_profiles) merged_user = {} # merged user profile # collect ordinary fields - for key in ['seq', 'user_name', 'user_id', 'gerrit_id', 'github_id', - 'launchpad_id', 'companies', 'static', 'zanata_id']: + for key in ['seq', 'user_name', 'user_id', 'github_id', 'launchpad_id', + 'companies', 'static', 'zanata_id']: value = next((v.get(key) for v in user_profiles if v.get(key)), None) if value: @@ -218,9 +237,12 @@ def merge_user_profiles(domains_index, user_profiles): for u in user_profiles: emails |= set(u.get('emails', [])) core_in |= set(u.get('core', [])) - merged_user['emails'] = list(emails) + merged_user['emails'] = sorted(list(emails)) if core_in: - merged_user['core'] = list(core_in) + merged_user['core'] = sorted(list(core_in)) + gerrit_ids = _merge_gerrit_ids(user_profiles) + if gerrit_ids: + merged_user['gerrit_ids'] = gerrit_ids # merge companies merged_companies = merged_user['companies'] diff --git a/stackalytics/tests/unit/test_record_processor.py b/stackalytics/tests/unit/test_record_processor.py index 047e7c91f..f065789dd 100644 --- a/stackalytics/tests/unit/test_record_processor.py +++ b/stackalytics/tests/unit/test_record_processor.py @@ -398,6 +398,7 @@ class TestRecordProcessor(testtools.TestCase): processed_review = list(record_processor_inst.process([ {'record_type': 'review', 'id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3e', + 'gerrit_hostname': 'review.openstack.org', 'subject': 'Fix AttributeError in Keypair._add_details()', 'owner': {'name': 'John Doe', 'email': 'johndoe@ibm.com', @@ -416,7 +417,8 @@ class TestRecordProcessor(testtools.TestCase): self.assertRecordsMatch(expected_review, processed_review) user = user_processor.load_user( record_processor_inst.runtime_storage_inst, user_id='john_doe') - self.assertEqual('John_Doe', user['gerrit_id']) + self.assertEqual('John_Doe', + user['gerrit_ids']['review.openstack.org'][0]) def test_process_review_without_name(self): record_processor_inst = self.make_record_processor() @@ -424,6 +426,7 @@ class TestRecordProcessor(testtools.TestCase): records = list(record_processor_inst.process([ { 'record_type': 'review', + 'gerrit_hostname': 'review.openstack.org', 'module': 'sandbox', "project": "openstack-dev/sandbox", "branch": "master", @@ -661,6 +664,7 @@ class TestRecordProcessor(testtools.TestCase): 'date_created': 1234567890}, {'record_type': 'review', 'id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3e', + 'gerrit_hostname': 'review.openstack.org', 'subject': 'Fix AttributeError in Keypair._add_details()', 'owner': {'name': 'John Doe', 'email': 'john_doe@gmail.com', @@ -687,7 +691,7 @@ class TestRecordProcessor(testtools.TestCase): user = {'seq': 1, 'user_id': 'john_doe', 'launchpad_id': 'john_doe', - 'gerrit_id': 'john_doe', + 'gerrit_ids': {'review.openstack.org': ['john_doe']}, 'user_name': 'John Doe', 'emails': ['john_doe@gmail.com'], 'companies': [{'company_name': '*independent', 'end_date': 0}]} @@ -757,6 +761,7 @@ class TestRecordProcessor(testtools.TestCase): processed_records = list(record_processor_inst.process([ {'record_type': 'review', 'id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3e', + 'gerrit_hostname': 'review.openstack.org', 'subject': 'Fix AttributeError in Keypair._add_details()', 'owner': {'name': 'John Doe', 'email': 'john_doe@gmail.com', @@ -788,7 +793,7 @@ class TestRecordProcessor(testtools.TestCase): user = {'seq': 1, 'user_id': 'john_doe', 'launchpad_id': 'john_doe', - 'gerrit_id': 'john_doe', + 'gerrit_ids': {'review.openstack.org': ['john_doe']}, 'user_name': 'John Doe', 'emails': ['john_doe@gmail.com'], 'companies': [{'company_name': '*independent', 'end_date': 0}]} @@ -867,6 +872,7 @@ class TestRecordProcessor(testtools.TestCase): 'date': 1234567890}, {'record_type': 'review', 'id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3e', + 'gerrit_hostname': 'review.openstack.org', 'subject': 'Fix AttributeError in Keypair._add_details()', 'owner': {'name': 'John Doe', 'email': 'john_doe@gmail.com', @@ -877,7 +883,7 @@ class TestRecordProcessor(testtools.TestCase): user = {'seq': 1, 'user_id': 'john_doe@gmail.com', - 'gerrit_id': 'john_doe', + 'gerrit_ids': {'review.openstack.org': ['john_doe']}, 'user_name': 'John Doe', 'emails': ['john_doe@gmail.com'], 'companies': [{'company_name': '*independent', 'end_date': 0}]} @@ -886,7 +892,7 @@ class TestRecordProcessor(testtools.TestCase): email='john_doe@gmail.com')) self.assertEqual(user, user_processor.load_user( record_processor_inst.runtime_storage_inst, - gerrit_id='john_doe')) + gerrit_tuple=('review.openstack.org', 'john_doe'))) def test_process_email_then_review_gerrit_id_same_as_launchpad_id(self): # it is expected that the user profile will contain email, LP id and @@ -905,6 +911,7 @@ class TestRecordProcessor(testtools.TestCase): 'date': 1234567890}, {'record_type': 'review', 'id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3e', + 'gerrit_hostname': 'review.openstack.org', 'subject': 'Fix AttributeError in Keypair._add_details()', 'owner': {'name': 'John Doe', 'email': 'john_doe@gmail.com', @@ -916,7 +923,7 @@ class TestRecordProcessor(testtools.TestCase): user = {'seq': 1, 'user_id': 'john_doe', 'launchpad_id': 'john_doe', - 'gerrit_id': 'john_doe', + 'gerrit_ids': {'review.openstack.org': ['john_doe']}, 'user_name': 'John Doe', 'emails': ['john_doe@gmail.com'], 'companies': [{'company_name': '*independent', 'end_date': 0}]} @@ -928,7 +935,7 @@ class TestRecordProcessor(testtools.TestCase): user_id='john_doe')) self.assertEqual(user, user_processor.load_user( record_processor_inst.runtime_storage_inst, - gerrit_id='john_doe')) + gerrit_tuple=('review.openstack.org', 'john_doe'))) def test_process_commit_then_review_with_different_email(self): record_processor_inst = self.make_record_processor( @@ -946,6 +953,7 @@ class TestRecordProcessor(testtools.TestCase): 'release_name': 'havana'}, {'record_type': 'review', 'id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3e', + 'gerrit_hostname': 'review.openstack.org', 'subject': 'Fix AttributeError in Keypair._add_details()', 'owner': {'name': 'Bill Smith', 'email': 'bill@smith.to', 'username': 'bsmith'}, @@ -966,6 +974,7 @@ class TestRecordProcessor(testtools.TestCase): user = {'seq': 1, 'user_id': 'john_doe', 'launchpad_id': 'john_doe', + 'gerrit_ids': {'review.openstack.org': ['john_doe']}, 'user_name': 'John Doe', 'emails': ['john_doe@ibm.com', 'john_doe@gmail.com'], 'companies': [{'company_name': 'IBM', 'end_date': 0}]} @@ -1002,6 +1011,7 @@ class TestRecordProcessor(testtools.TestCase): 'date': 1234567890}, {'record_type': 'review', 'id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3e', + 'gerrit_hostname': 'review.openstack.org', 'subject': 'Fix AttributeError in Keypair._add_details()', 'owner': {'name': 'John Doe', 'email': 'john_doe@ibm.com', @@ -1015,7 +1025,7 @@ class TestRecordProcessor(testtools.TestCase): user = {'seq': 2, 'user_id': 'john_doe', 'launchpad_id': 'john_doe', - 'gerrit_id': 'john_doe', + 'gerrit_ids': {'review.openstack.org': ['john_doe']}, 'user_name': 'John Doe', 'emails': ['john_doe@ibm.com'], 'companies': [{'company_name': 'IBM', 'end_date': 0}]} @@ -1030,7 +1040,138 @@ class TestRecordProcessor(testtools.TestCase): self.assertEqual(user, user_processor.load_user( runtime_storage_inst, email='john_doe@ibm.com')) self.assertEqual(user, user_processor.load_user( - runtime_storage_inst, gerrit_id='john_doe')) + runtime_storage_inst, + gerrit_tuple=('review.openstack.org', 'john_doe'))) + + # all records should have the same user_id and company name + for record in runtime_storage_inst.get_all_records(): + self.assertEqual('john_doe', record['user_id'], + message='Record %s' % record['primary_key']) + self.assertEqual('IBM', record['company_name'], + message='Record %s' % record['primary_key']) + + def test_process_reviews_two_gerrits(self): + record_processor_inst = self.make_record_processor( + lp_user_name={ + 'john_doe': {'name': 'john_doe', 'display_name': 'John Doe'} + }, + companies=[{'company_name': 'IBM', 'domains': ['ibm.com']}], + ) + runtime_storage_inst = record_processor_inst.runtime_storage_inst + + runtime_storage_inst.set_records(record_processor_inst.process([ + {'record_type': 'review', + 'id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3e', + 'gerrit_hostname': 'review.openstack.org', + 'subject': 'Fix AttributeError in Keypair._add_details()', + 'owner': {'name': 'John Doe', + 'email': 'john_doe@ibm.com', + 'username': 'john_doe'}, + 'createdOn': 1379404951, + 'module': 'nova', 'branch': 'master'}, + {'record_type': 'review', + 'id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3f', + 'gerrit_hostname': 'review.gerrithub.io', + 'subject': 'Fix AttributeError in Keypair._add_details()', + 'owner': {'name': 'John Doe', + 'email': 'john_doe@ibm.com', + 'username': 'john_doe'}, + 'createdOn': 1379404951, + 'module': 'cinder', 'branch': 'master'} + ])) + + user = {'seq': 1, + 'user_id': 'john_doe', + 'launchpad_id': 'john_doe', + 'gerrit_ids': { + 'review.openstack.org': ['john_doe'], + 'review.gerrithub.io': ['john_doe'], + }, + 'user_name': 'John Doe', + 'emails': ['john_doe@ibm.com'], + 'companies': [{'company_name': 'IBM', 'end_date': 0}]} + runtime_storage_inst = record_processor_inst.runtime_storage_inst + self.assertEqual(user, user_processor.load_user( + runtime_storage_inst, user_id='john_doe')) + self.assertEqual(user, user_processor.load_user( + runtime_storage_inst, email='john_doe@ibm.com')) + self.assertEqual(user, user_processor.load_user( + runtime_storage_inst, + gerrit_tuple=('review.openstack.org', 'john_doe'))) + self.assertEqual(user, user_processor.load_user( + runtime_storage_inst, + gerrit_tuple=('review.gerrithub.io', 'john_doe'))) + + # all records should have the same user_id and company name + for record in runtime_storage_inst.get_all_records(): + self.assertEqual('john_doe', record['user_id'], + message='Record %s' % record['primary_key']) + self.assertEqual('IBM', record['company_name'], + message='Record %s' % record['primary_key']) + + def test_process_reviews_two_ids_in_one_gerrit(self): + record_processor_inst = self.make_record_processor( + lp_user_name={ + 'john_doe': {'name': 'john_doe', 'display_name': 'John Doe'} + }, + companies=[{'company_name': 'IBM', 'domains': ['ibm.com']}], + ) + runtime_storage_inst = record_processor_inst.runtime_storage_inst + + runtime_storage_inst.set_records(record_processor_inst.process([ + {'record_type': 'review', + 'id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3e', + 'gerrit_hostname': 'review.openstack.org', + 'subject': 'Fix AttributeError in Keypair._add_details()', + 'owner': {'name': 'John Doe', + 'email': 'john_doe@ibm.com', + 'username': 'john_doe'}, + 'createdOn': 1379404951, + 'module': 'nova', 'branch': 'master'}, + {'record_type': 'review', + 'id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3f', + 'gerrit_hostname': 'review.openstack.org', + 'subject': 'Fix AttributeError in Keypair._add_details()', + 'owner': {'name': 'John Doe', + 'email': 'john_doe@ibm.com', + 'username': 'johnathan_doe'}, + 'createdOn': 1379404951, + 'module': 'nova', 'branch': 'master'}, + {'record_type': 'review', + 'id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3i', + 'gerrit_hostname': 'review.gerrithub.io', + 'subject': 'Fix AttributeError in Keypair._add_details()', + 'owner': {'name': 'John Doe', + 'email': 'john_doe@ibm.com', + 'username': 'johnathan_doe'}, + 'createdOn': 1379404951, + 'module': 'cinder', 'branch': 'master'} + ])) + + user = {'seq': 1, + 'user_id': 'john_doe', + 'launchpad_id': 'john_doe', + 'gerrit_ids': { + 'review.openstack.org': ['john_doe', 'johnathan_doe'], + 'review.gerrithub.io': ['johnathan_doe'], + }, + 'user_name': 'John Doe', + 'emails': ['john_doe@ibm.com'], + 'companies': [{'company_name': 'IBM', 'end_date': 0}]} + runtime_storage_inst = record_processor_inst.runtime_storage_inst + self.assertEqual(user, user_processor.load_user( + runtime_storage_inst, user_id='john_doe')) + self.assertEqual(user, user_processor.load_user( + runtime_storage_inst, email='john_doe@ibm.com')) + self.assertEqual(user, user_processor.load_user( + runtime_storage_inst, + gerrit_tuple=('review.openstack.org', 'john_doe'))) + self.assertEqual(user, user_processor.load_user( + runtime_storage_inst, + gerrit_tuple=('review.openstack.org', 'johnathan_doe'))) + self.assertEqual(user, user_processor.load_user( + runtime_storage_inst, + gerrit_tuple=('review.gerrithub.io', 'johnathan_doe'))) # all records should have the same user_id and company name for record in runtime_storage_inst.get_all_records(): @@ -1053,6 +1194,7 @@ class TestRecordProcessor(testtools.TestCase): runtime_storage_inst.set_records(record_processor_inst.process([ {'record_type': 'review', 'id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3e', + 'gerrit_hostname': 'review.openstack.org', 'subject': 'Fix AttributeError in Keypair._add_details()', 'owner': {'name': 'John Doe', 'email': 'john_doe@ibm.com', @@ -1228,6 +1370,7 @@ class TestRecordProcessor(testtools.TestCase): runtime_storage_inst.set_records(record_processor_inst.process([ {'record_type': 'review', 'id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3e', + 'gerrit_hostname': 'review.openstack.org', 'subject': 'Fix AttributeError in Keypair._add_details()', 'owner': {'name': 'John Doe', 'email': 'john_doe@ibm.com', @@ -1328,6 +1471,7 @@ class TestRecordProcessor(testtools.TestCase): 'release_name': 'havana'}, {'record_type': 'review', 'id': 'I104573', + 'gerrit_hostname': 'review.openstack.org', 'subject': 'Fix AttributeError in Keypair._add_details()', 'owner': {'name': 'John Doe', 'email': 'john_doe@gmail.com', @@ -1361,6 +1505,7 @@ class TestRecordProcessor(testtools.TestCase): 'release_name': 'havana'}, {'record_type': 'review', 'id': 'I104573', + 'gerrit_hostname': 'review.openstack.org', 'subject': 'Fix AttributeError in Keypair._add_details()', 'owner': {'name': 'John Doe', 'email': 'john_doe@gmail.com',