def testMakeAnomalyEntity_AlertGrouping(self): data_sample = { 'type': 'GenericSet', 'guid': 'eb212e80-db58-4cbd-b331-c2245ecbb826', 'values': ['group123', 'group234'] } testing_common.AddTests( ['ChromiumPerf'], ['linux'], { 'page_cycler_v2': { 'cnn': {}, 'cnn_ref': {}, 'yahoo': {}, 'nytimes': {}, }, }) test = utils.TestKey('ChromiumPerf/linux/page_cycler_v2/cnn').get() testing_common.AddRows(test.test_path, [100, 200, 300, 400]) suite_key = utils.TestKey('ChromiumPerf/linux/page_cycler_v2') entity = histogram.SparseDiagnostic( data=data_sample, test=suite_key, start_revision=1, end_revision=sys.maxsize, id=data_sample['guid'], name=reserved_infos.ALERT_GROUPING.name) entity.put() entity.put() alert = find_anomalies._MakeAnomalyEntity( _MakeSampleChangePoint(10011, 50, 100), test, 'avg', self._DataSeries()).get_result() self.assertEqual(alert.alert_grouping, ['group123', 'group234'])
def testMakeAnomalyEntity_AddsOwnership(self): data = json.dumps({ 'type': 'Ownership', 'guid': 'eb212e80-db58-4cbd-b331-c2245ecbb826', 'emails': ['*****@*****.**', '*****@*****.**'], 'component': 'fooBar' }) testing_common.AddTests( ['ChromiumPerf'], ['linux'], { 'page_cycler_v2': { 'cnn': {}, 'cnn_ref': {}, 'yahoo': {}, 'nytimes': {}, }, }) test_key = utils.TestKey('ChromiumPerf/linux/page_cycler_v2/cnn') test = test_key.get() testing_common.AddRows(test.test_path, [100, 200, 300, 400]) entity = histogram.SparseDiagnostic(data=data, test=test_key, id='abc', start_revision=1, end_revision=sys.maxint) entity.put() alert = find_anomalies._MakeAnomalyEntity( _MakeSampleChangePoint(10011, 50, 100), test, list(graph_data.Row.query())) self.assertEqual(alert.ownership['component'], 'fooBar') self.assertListEqual(alert.ownership['emails'], ['*****@*****.**', '*****@*****.**'])
def testMakeAnomalyEntity_AddsOwnership(self): data_samples = [{ 'type': 'GenericSet', 'guid': 'eb212e80-db58-4cbd-b331-c2245ecbb826', 'values': ['*****@*****.**', '*****@*****.**'] }, { 'type': 'GenericSet', 'guid': 'eb212e80-db58-4cbd-b331-c2245ecbb827', 'values': ['abc'] }] test_key = utils.TestKey('ChromiumPerf/linux/page_cycler_v2/cnn') testing_common.AddTests( ['ChromiumPerf'], ['linux'], { 'page_cycler_v2': { 'cnn': {}, 'cnn_ref': {}, 'yahoo': {}, 'nytimes': {}, }, }) test = test_key.get() testing_common.AddRows(test.test_path, [100, 200, 300, 400]) suite_key = utils.TestKey('ChromiumPerf/linux/page_cycler_v2') entity = histogram.SparseDiagnostic(data=data_samples[0], test=suite_key, start_revision=1, end_revision=sys.maxsize, id=data_samples[0]['guid'], name=reserved_infos.OWNERS.name) entity.put() entity = histogram.SparseDiagnostic( data=data_samples[1], test=suite_key, start_revision=1, end_revision=sys.maxsize, id=data_samples[1]['guid'], name=reserved_infos.BUG_COMPONENTS.name) entity.put() alert = find_anomalies._MakeAnomalyEntity( _MakeSampleChangePoint(10011, 50, 100), test, 'avg', self._DataSeries()).get_result() self.assertEqual(alert.ownership['component'], 'abc') self.assertListEqual(alert.ownership['emails'], ['*****@*****.**', '*****@*****.**'])
def testMakeAnomalyEntity_NoRefBuild(self): testing_common.AddTests(['ChromiumPerf'], ['linux'], { 'page_cycler_v2': { 'cnn': {}, 'yahoo': {}, 'nytimes': {}, }, }) test = utils.TestKey('ChromiumPerf/linux/page_cycler_v2').get() testing_common.AddRows(test.test_path, [100, 200, 300, 400]) alert = find_anomalies._MakeAnomalyEntity( _MakeSampleChangePoint(10011, 50, 100), test, 'avg', self._DataSeries()).get_result() self.assertIsNone(alert.ref_test)
def testMakeAnomalyEntity_AddsOwnership(self): data_samples = [ { 'type': 'GenericSet', 'guid': 'eb212e80-db58-4cbd-b331-c2245ecbb826', 'values': ['*****@*****.**', '*****@*****.**'] }, { 'type': 'GenericSet', 'guid': 'eb212e80-db58-4cbd-b331-c2245ecbb827', 'values': ['abc'] }] test_key = utils.TestKey('ChromiumPerf/linux/page_cycler_v2/cnn') testing_common.AddTests( ['ChromiumPerf'], ['linux'], { 'page_cycler_v2': { 'cnn': {}, 'cnn_ref': {}, 'yahoo': {}, 'nytimes': {}, }, }) test = test_key.get() testing_common.AddRows(test.test_path, [100, 200, 300, 400]) suite_key = utils.TestKey('ChromiumPerf/linux/page_cycler_v2') entity = histogram.SparseDiagnostic( data=data_samples[0], test=suite_key, start_revision=1, end_revision=sys.maxsize, id=data_samples[0]['guid'], name=reserved_infos.OWNERS.name) entity.put() entity = histogram.SparseDiagnostic( data=data_samples[1], test=suite_key, start_revision=1, end_revision=sys.maxsize, id=data_samples[1]['guid'], name=reserved_infos.BUG_COMPONENTS.name) entity.put() alert = find_anomalies._MakeAnomalyEntity( _MakeSampleChangePoint(10011, 50, 100), test, 'avg', self._DataSeries()).get_result() self.assertEqual(alert.ownership['component'], 'abc') self.assertListEqual(alert.ownership['emails'], ['*****@*****.**', '*****@*****.**'])
def testMakeAnomalyEntity_NoRefBuild(self): testing_common.AddTests( ['ChromiumPerf'], ['linux'], { 'page_cycler_v2': { 'cnn': {}, 'yahoo': {}, 'nytimes': {}, }, }) test = utils.TestKey('ChromiumPerf/linux/page_cycler_v2').get() testing_common.AddRows(test.test_path, [100, 200, 300, 400]) alert = find_anomalies._MakeAnomalyEntity( _MakeSampleChangePoint(10011, 50, 100), test, list(graph_data.Row.query())) self.assertIsNone(alert.ref_test)
def testMakeAnomalyEntity_RefBuildUnderscore(self): testing_common.AddTests( ['ChromiumPerf'], ['linux'], { 'page_cycler_v2': { 'cnn': {}, 'cnn_ref': {}, 'yahoo': {}, 'nytimes': {}, }, }) test = utils.TestKey('ChromiumPerf/linux/page_cycler_v2/cnn').get() testing_common.AddRows(test.test_path, [100, 200, 300, 400]) alert = find_anomalies._MakeAnomalyEntity( _MakeSampleChangePoint(10011, 50, 100), test, list(graph_data.Row.query())) self.assertEqual(alert.ref_test.string_id(), 'ChromiumPerf/linux/page_cycler_v2/cnn_ref')
def testMakeAnomalyEntity_RefBuildSlash(self): testing_common.AddTests( ['ChromiumPerf'], ['linux'], { 'page_cycler_v2': { 'ref': {}, 'cnn': {}, 'yahoo': {}, 'nytimes': {}, }, }) test = utils.TestKey('ChromiumPerf/linux/page_cycler_v2').get() testing_common.AddRows(test.test_path, [100, 200, 300, 400]) alert = find_anomalies._MakeAnomalyEntity( _MakeSampleChangePoint(10011, 50, 100), test, 'avg', self._DataSeries()).get_result() self.assertEqual(alert.ref_test.string_id(), 'ChromiumPerf/linux/page_cycler_v2/ref')
def testMakeAnomalyEntity_RevisionRanges(self): testing_common.AddTests(['ClankInternal'], ['linux'], { 'page_cycler_v2': { 'cnn': {}, 'cnn_ref': {}, 'yahoo': {}, 'nytimes': {}, }, }) test = utils.TestKey('ClankInternal/linux/page_cycler_v2/cnn').get() testing_common.AddRows(test.test_path, [100, 200, 300, 400]) for row in graph_data.Row.query(): # Different enough to ensure it is picked up properly. row.r_commit_pos = int(row.value) + 2 row.put() alert = find_anomalies._MakeAnomalyEntity( _MakeSampleChangePoint(300, 50, 100), test, 'avg', self._DataSeries()).get_result() self.assertEqual(alert.display_start, 203) self.assertEqual(alert.display_end, 302)
def testMakeAnomalyEntity_RevisionRanges(self): testing_common.AddTests( ['ClankInternal'], ['linux'], { 'page_cycler_v2': { 'cnn': {}, 'cnn_ref': {}, 'yahoo': {}, 'nytimes': {}, }, }) test = utils.TestKey('ClankInternal/linux/page_cycler_v2/cnn').get() testing_common.AddRows(test.test_path, [100, 200, 300, 400]) for row in graph_data.Row.query(): row.r_commit_pos = int(row.value) + 2 # Different enough to ensure it is # picked up properly. row.put() alert = find_anomalies._MakeAnomalyEntity( _MakeSampleChangePoint(300, 50, 100), test, list(graph_data.Row.query())) self.assertEqual(alert.display_start, 203) self.assertEqual(alert.display_end, 302)