def testUpdateTestLocationAndTagsNoComponent(self, *_):
    flake = Flake(
        normalized_test_name='suite.test',
        tags=['gerrit_project::chromium/src'],
    )
    occurrences = [
        FlakeOccurrence(step_ui_name='browser_tests'),
    ]
    component_mapping = {
        'base/feature/': 'root>a>b',
        'base/feature/url': 'root>a>b>c',
    }
    watchlist = {
        'feature': 'base/feature',
        'url': r'base/feature/url_test\.cc',
        'other': 'a/b/c',
    }

    expected_tags = sorted([
        'gerrit_project::chromium/src',
        'directory::unknown/',
        'source::unknown/path.cc',
        'component::Unknown',
        'parent_component::Unknown',
    ])

    for tag in flake.tags:
      name = tag.split(TAG_DELIMITER)[0]
      self.assertTrue(name in detect_flake_occurrences.SUPPORTED_TAGS)

    self.assertTrue(
        detect_flake_occurrences._UpdateTestLocationAndTags(
            flake, occurrences, component_mapping, watchlist))
    self.assertEqual(expected_tags, flake.tags)
 def testUpdateTestLocationAndTagsRecentlyUpdated(self, _):
   flake = Flake(
       normalized_test_name='suite.test',
       tags=['gerrit_project::chromium/src'],
   )
   flake.last_test_location_based_tag_update_time = datetime(2019, 6, 1)
   self.assertFalse(
       detect_flake_occurrences._UpdateTestLocationAndTags(flake, [], {}, {}))
Exemplo n.º 3
0
    def testUpdateTestLocationAndTagsGPUTest(self, *_):
        flake = Flake(
            normalized_test_name='suite.test',
            normalized_step_name='telemetry_gpu_integration_test',
            tags=['gerrit_project::chromium/src'],
        )
        occurrences = [
            FlakeOccurrence(step_ui_name='context_lost_tests',
                            build_configuration=BuildConfiguration(
                                legacy_master_name='master',
                                luci_builder='builder',
                                legacy_build_number=123,
                            )),
            FlakeOccurrence(
                step_ui_name='webgl_conformance_vulkan_passthrough_tests',
                build_configuration=BuildConfiguration(
                    legacy_master_name='master',
                    luci_builder='builder',
                    legacy_build_number=124,
                )),
        ]
        component_mapping = {
            'base/feature/': 'root>a>b',
            'base/feature/url': 'root>a>b>c',
        }
        watchlist = {
            'feature': 'base/feature',
            'url': r'base/feature/url_test\.cc',
            'other': 'a/b/c',
        }

        expected_tags = sorted([
            'gerrit_project::chromium/src', 'component::Internals>GPU>Testing',
            'component::Blink>WebGL'
        ])

        for tag in flake.tags:
            name = tag.split(TAG_DELIMITER)[0]
            self.assertTrue(name in detect_flake_occurrences.SUPPORTED_TAGS)

        self.assertTrue(
            detect_flake_occurrences._UpdateTestLocationAndTags(
                flake, occurrences, component_mapping, watchlist))
        self.assertEqual(expected_tags, flake.tags)