def test_event_hash_variant(insta_snapshot, config_name, test_name, log): with open(os.path.join(_fixture_path, test_name + '.json')) as f: input = json.load(f) # Cutomize grouping config from the _grouping config grouping_config = get_default_grouping_config_dict(config_name) grouping_info = input.pop('_grouping', None) or {} enhancement_base = grouping_info.get('enhancement_base') enhancements = grouping_info.get('enhancements') if enhancement_base or enhancements: enhancement_bases = [enhancement_base] if enhancement_base else [] e = Enhancements.from_config_string(enhancements or '', bases=enhancement_bases) grouping_config['enhancements'] = e.dumps() # Noramlize the event mgr = EventManager(data=input, grouping_config=grouping_config) mgr.normalize() data = mgr.get_data() # Normalize the stacktrace for grouping. This normally happens in # save() normalize_stacktraces_for_grouping(data, load_grouping_config(grouping_config)) evt = Event(data=data, platform=data['platform']) # Make sure we don't need to touch the DB here because this would # break stuff later on. evt.project = None rv = [] for (key, value) in sorted(evt.get_grouping_variants().items()): if rv: rv.append('-' * 74) rv.append('%s:' % key) dump_variant(value, rv, 1) output = '\n'.join(rv) log(repr(evt.get_hashes())) assert evt.get_grouping_config() == grouping_config insta_snapshot(output)
def test_event_hash_variant(insta_snapshot, config_name, test_name, log): with open(os.path.join(_fixture_path, test_name + '.json')) as f: input = json.load(f) grouping_config = { 'id': config_name, } mgr = EventManager(data=input, grouping_config=grouping_config) mgr.normalize() data = mgr.get_data() evt = Event(data=data, platform=data['platform']) rv = [] for (key, value) in sorted(evt.get_grouping_variants().items()): if rv: rv.append('-' * 74) rv.append('%s:' % key) dump_variant(value, rv, 1) output = '\n'.join(rv) log(repr(evt.get_hashes())) assert evt.get_grouping_config() == grouping_config insta_snapshot(output)