def GetFlake(luci_project, original_step_name, original_test_name, master_name, builder_name, build_number): """Returns an existing Flake or creates one as needed. Args: luci_project (str): The project being analyzed, e.g. 'chromium'. original_step_name (str): The original step name which may contain hardware information and 'with(out) patch' etc. suffixes. original_test_name (str): The original test name. master_name (str): Master name of the build of the step. builder_name (str): Builder name of the build of the step. build_number (int): Build number of the build of the step. """ normalized_step_name = Flake.LegacyNormalizeStepName( original_step_name, master_name, builder_name, build_number) normalized_test_name = Flake.NormalizeTestName(original_test_name, original_step_name) flake = Flake.Get(luci_project, normalized_step_name, normalized_test_name) if not flake: # pragma: no branch label = Flake.GetTestLabelName(original_test_name, original_step_name) flake = Flake.Create(luci_project, normalized_step_name, normalized_test_name, label) flake.put() return flake
def testGetTestLabelName(self): self.assertEqual( 'suite.test', Flake.GetTestLabelName('suite.test', 'base_unittests')) self.assertEqual( 'suite.test/*', Flake.GetTestLabelName('suite.test/1', 'base_unittests')) self.assertEqual( '*/suite.test/*', Flake.GetTestLabelName('a/suite.test/0', 'base_unittests')) self.assertEqual( 'suite.*test', Flake.GetTestLabelName('suite.PRE_PRE_test', 'base_unittests')) self.assertEqual( '*/suite.*test/*', Flake.GetTestLabelName('a/suite.PRE_PRE_test/0', 'base_unittests')) self.assertEqual( 'a/b.html', Flake.NormalizeTestName('a/b.html', 'webkit_layout_tests')) self.assertEqual( 'a/b.html?*', Flake.GetTestLabelName('a/b.html?1000-2000', 'webkit_layout_tests'))
def _CreateFlakeFromRow(row): """Creates a Flake entity from a row fetched from BigQuery.""" luci_project = row['luci_project'] luci_builder = row['luci_builder'] legacy_master_name = row['legacy_master_name'] legacy_build_number = row['legacy_build_number'] step_ui_name = row['step_ui_name'] test_name = row['test_name'] normalized_step_name = Flake.NormalizeStepName( step_name=step_ui_name, master_name=legacy_master_name, builder_name=luci_builder, build_number=legacy_build_number) normalized_test_name = Flake.NormalizeTestName(test_name, step_ui_name) test_label_name = Flake.GetTestLabelName(test_name, step_ui_name) return Flake.Create(luci_project=luci_project, normalized_step_name=normalized_step_name, normalized_test_name=normalized_test_name, test_label_name=test_label_name)
def GetTestLabelName(self): # Issues are filed with the test label name. return Flake.GetTestLabelName(self._analysis.test_name, self._analysis.step_name)