Exemple #1
0
 def testCreateRowEntities_SuffixesRefProperly(self):
     test_path0 = 'Chromium/win7/suite/metric_ref'
     test_path1 = 'Chromium/win7/suite/metric/ref'
     test_key0 = utils.TestKey(test_path0)
     test_key1 = utils.TestKey(test_path1)
     rows_to_put = add_histograms_queue.CreateRowEntities(
         TEST_HISTOGRAM, test_key0, {}, 123)
     rows_to_put += add_histograms_queue.CreateRowEntities(
         TEST_HISTOGRAM, test_key1, {}, 123)
     ndb.put_multi(rows_to_put)
     rows = graph_data.Row.query().fetch()
     for row in rows:
         self.assertTrue(row.key.parent().id().endswith('ref'))
Exemple #2
0
    def testCreateRowEntities_UsesStandardDeviationProperty(self):
        test_path = 'Chromium/win7/suite/metric'
        test_key = utils.TestKey(test_path)

        hist = histogram_module.Histogram.FromDict(TEST_HISTOGRAM)
        hist.CustomizeSummaryOptions({
            'avg': True,
            'std': False,
            'count': False,
            'max': False,
            'min': False,
            'sum': False
        })

        stat_names_to_test_keys = {
            'avg': utils.TestKey('Chromium/win7/suite/metric_avg')
        }
        rows = add_histograms_queue.CreateRowEntities(hist.AsDict(), test_key,
                                                      stat_names_to_test_keys,
                                                      123)

        self.assertEqual(2, len(rows))

        ndb.put_multi(rows)
        row = graph_data.Row.query().fetch()[1]

        self.assertAlmostEqual(1.0, row.error)
Exemple #3
0
    def testCreateRowEntities_WithCustomSummaryOptions(self):
        test_path = 'Chromium/win7/suite/metric'
        test_key = utils.TestKey(test_path)

        hist = histogram_module.Histogram.FromDict(TEST_HISTOGRAM)
        hist.CustomizeSummaryOptions({
            'avg': True,
            'std': True,
            'count': True,
            'max': False,
            'min': False,
            'sum': False
        })

        stat_names_to_test_keys = {
            'avg': utils.TestKey('Chromium/win7/suite/metric_avg'),
            'std': utils.TestKey('Chromium/win7/suite/metric_std'),
            'count': utils.TestKey('Chromium/win7/suite/metric_count')
        }
        rows = add_histograms_queue.CreateRowEntities(hist.AsDict(), test_key,
                                                      stat_names_to_test_keys,
                                                      123)

        self.assertEqual(4, len(rows))

        ndb.put_multi(rows)
        row = graph_data.Row.query().fetch()[0]
        fields = row.to_dict().iterkeys()
        d_fields = [field for field in fields if field.startswith('d_')]

        self.assertEqual(1, len(d_fields))
        self.assertEqual(3, row.d_count)
Exemple #4
0
    def testCreateRowEntities_DoesntAddRowForEmptyHistogram(self):
        hist = histogram_module.Histogram('foo', 'count').AsDict()
        test_path = 'Chromium/win7/suite/metric'
        test_key = utils.TestKey(test_path)
        row = add_histograms_queue.CreateRowEntities(hist, test_key, {}, 123)

        rows = graph_data.Row.query().fetch()
        self.assertEqual(0, len(rows))
        self.assertIsNone(row)
Exemple #5
0
 def testCreateRowEntities_SetsInternalOnly(self):
     test_path = 'Chromium/win7/suite/metric'
     test_key = utils.TestKey(test_path)
     rows_to_put = add_histograms_queue.CreateRowEntities(
         TEST_HISTOGRAM, test_key, {}, 123, True)
     ndb.put_multi(rows_to_put)
     rows = graph_data.Row.query().fetch()
     for row in rows:
         self.assertTrue(row.internal_only)
Exemple #6
0
  def testCreateRowEntities_AddsTraceUri(self):
    test_path = 'Chromium/win7/suite/metric/story'
    test_key = utils.TestKey(test_path)
    hist = copy.deepcopy(TEST_HISTOGRAM)

    row = add_histograms_queue.CreateRowEntities(hist, test_key, {}, 123)[0]
    row_dict = row.to_dict()

    self.assertIn('a_tracing_uri', row_dict)
    self.assertEqual(row_dict['a_tracing_uri'], 'http://google.com/')
Exemple #7
0
  def testCreateRowEntities_FailsWithNonSingularRevisionInfo(self):
    test_path = 'Chromium/win7/suite/metric'
    test_key = utils.TestKey(test_path)
    hist = copy.deepcopy(TEST_HISTOGRAM)
    hist['diagnostics'][reserved_infos.CATAPULT_REVISIONS.name] = {
        'type': 'GenericSet', 'values': [123, 456]}

    with self.assertRaises(add_histograms_queue.BadRequestError):
      add_histograms_queue.CreateRowEntities(
          hist, test_key, {}, 123).put()
Exemple #8
0
  def testCreateRowEntities_DoesNotAddTraceUriForSummary(self):
    test_path = 'Chromium/win7/suite/metric'
    test_key = utils.TestKey(test_path)
    hist = copy.deepcopy(TEST_HISTOGRAM)
    hist['diagnostics'][reserved_infos.SUMMARY_KEYS.name] = {
        'type': 'GenericSet', 'values': ['stories']}

    row = add_histograms_queue.CreateRowEntities(
        hist, test_key, {}, 123)[0]
    row_dict = row.to_dict()

    self.assertNotIn('a_tracing_uri', row_dict)
 def _CreateRows(self):
     test_path = 'Chromium/win7/suite/metric'
     test_key = utils.TestKey(test_path)
     stat_names_to_test_keys = {
         'avg': utils.TestKey('Chromium/win7/suite/metric_avg'),
         'std': utils.TestKey('Chromium/win7/suite/metric_std'),
         'count': utils.TestKey('Chromium/win7/suite/metric_count'),
         'max': utils.TestKey('Chromium/win7/suite/metric_max'),
         'min': utils.TestKey('Chromium/win7/suite/metric_min'),
         'sum': utils.TestKey('Chromium/win7/suite/metric_sum')
     }
     histograms = add_histograms_queue_test.TEST_HISTOGRAM
     histograms['diagnostics'][
         reserved_infos.CHROMIUM_COMMIT_POSITIONS.name]['values'] = [99]
     ndb.put_multi(
         add_histograms_queue.CreateRowEntities(histograms, test_key,
                                                stat_names_to_test_keys,
                                                99))
     histograms['diagnostics'][
         reserved_infos.CHROMIUM_COMMIT_POSITIONS.name]['values'] = [200]
     ndb.put_multi(
         add_histograms_queue.CreateRowEntities(
             add_histograms_queue_test.TEST_HISTOGRAM, test_key,
             stat_names_to_test_keys, 200))
Exemple #10
0
    def testCreateRowEntities(self):
        test_path = 'Chromium/win7/suite/metric'
        test_key = utils.TestKey(test_path)
        stat_names_to_test_keys = {
            'avg': utils.TestKey('Chromium/win7/suite/metric_avg'),
            'std': utils.TestKey('Chromium/win7/suite/metric_std'),
            'count': utils.TestKey('Chromium/win7/suite/metric_count'),
            'max': utils.TestKey('Chromium/win7/suite/metric_max'),
            'min': utils.TestKey('Chromium/win7/suite/metric_min'),
            'sum': utils.TestKey('Chromium/win7/suite/metric_sum')
        }
        rows_to_put = add_histograms_queue.CreateRowEntities(
            TEST_HISTOGRAM, test_key, stat_names_to_test_keys, 123)
        ndb.put_multi(rows_to_put)

        rows = graph_data.Row.query().fetch()
        rows_by_path = {}
        for row in rows:
            rows_by_path[row.key.parent().id()] = row

        avg_row = rows_by_path.pop('Chromium/win7/suite/metric_avg')
        self.assertAlmostEqual(2.0, avg_row.value)
        self.assertAlmostEqual(1.0, avg_row.error)
        std_row = rows_by_path.pop('Chromium/win7/suite/metric_std')
        self.assertAlmostEqual(1.0, std_row.value)
        self.assertEqual(0.0, std_row.error)
        count_row = rows_by_path.pop('Chromium/win7/suite/metric_count')
        self.assertEqual(3, count_row.value)
        self.assertEqual(0.0, count_row.error)
        max_row = rows_by_path.pop('Chromium/win7/suite/metric_max')
        self.assertAlmostEqual(3.0, max_row.value)
        self.assertEqual(0.0, max_row.error)
        min_row = rows_by_path.pop('Chromium/win7/suite/metric_min')
        self.assertAlmostEqual(1.0, min_row.value)
        self.assertEqual(0.0, min_row.error)
        sum_row = rows_by_path.pop('Chromium/win7/suite/metric_sum')
        self.assertAlmostEqual(6.0, sum_row.value)
        self.assertEqual(0.0, sum_row.error)

        row = rows_by_path.pop('Chromium/win7/suite/metric')
        self.assertEqual(0, len(rows_by_path))
        fields = row.to_dict().iterkeys()
        d_fields = []
        r_fields = []
        a_fields = []
        for field in fields:
            if field.startswith('d_'):
                d_fields.append(field)
            elif field.startswith('r_'):
                r_fields.append(field)
            elif field.startswith('a_'):
                a_fields.append(field)

        self.assertAlmostEqual(2.0, row.value)
        self.assertAlmostEqual(1.0, row.error)

        self.assertEqual(4, len(d_fields))
        self.assertEqual(3, row.d_count)
        self.assertAlmostEqual(3.0, row.d_max)
        self.assertAlmostEqual(1.0, row.d_min)
        self.assertAlmostEqual(6.0, row.d_sum)

        self.assertEqual(2, len(r_fields))
        self.assertEqual('4cd34ad3320db114ad3a2bd2acc02aba004d0cb4',
                         row.r_v8_rev)
        self.assertEqual('123', row.r_commit_pos)

        self.assertEqual('[Buildbot stdio](http://log.url/)', row.a_stdio_uri)