示例#1
0
 def testAddRow_SetsInternalOnly(self):
   test_path = 'Chromium/win7/suite/metric'
   test_key = utils.TestKey(test_path)
   add_histograms_queue.AddRow(
       TEST_HISTOGRAM, test_key, 123, test_path, True).put()
   row = graph_data.Row.query().fetch()[0]
   self.assertTrue(row.internal_only)
    def testAddRow(self):
        test_path = 'Chromium/win7/suite/metric'
        test_key = utils.TestKey(test_path)
        add_histograms_queue.AddRow(TEST_HISTOGRAM, test_key, 123, test_path,
                                    False)

        row = graph_data.Row.query().fetch()[0]
        fields = row.to_dict().iterkeys()
        d_fields = []
        r_fields = []
        for field in fields:
            if field.startswith('d_'):
                d_fields.append(field)
            elif field.startswith('r_'):
                r_fields.append(field)

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

        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_git)
        self.assertEqual('123', row.r_chromium_commit_pos)
    def testAddRow_DoesntAddRowForEmptyHistogram(self):
        hist = histogram_module.Histogram('foo', 'count').AsDict()
        test_path = 'Chromium/win7/suite/metric'
        test_key = utils.TestKey(test_path)
        add_histograms_queue.AddRow(hist, test_key, 123, test_path, True)

        rows = graph_data.Row.query().fetch()
        self.assertEqual(0, len(rows))
示例#4
0
    def testAddRow_FailsWithNonSingularRevisionInfo(self):
        test_path = 'Chromium/win7/suite/metric'
        test_key = utils.TestKey(test_path)
        hist = copy.deepcopy(TEST_HISTOGRAM)
        hist['diagnostics']['revisions']['catapult'] = [123, 456]

        with self.assertRaises(add_histograms_queue.BadRequestError):
            add_histograms_queue.AddRow(hist, test_key, 123, test_path, False)
示例#5
0
  def testAddRow_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.AddRow(hist, test_key, 123, test_path, False).put()
示例#6
0
  def testAddRow_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
        })
    add_histograms_queue.AddRow(
        hist.AsDict(), test_key, 123, test_path, False).put()
    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)