def test_missing_layout_test_results(self):
     tool = MockTool()
     reader = LayoutTestResultsReader(tool, "/var/logs")
     results_path = '/mock-results/results.html'
     tool.filesystem = MockFileSystem({results_path: None})
     # Make sure that our filesystem mock functions as we expect.
     self.assertRaises(IOError, tool.filesystem.read_text_file, results_path)
     # layout_test_results shouldn't raise even if the results.html file is missing.
     self.assertEquals(reader.results(), None)
 def test_missing_layout_test_results(self):
     tool = MockTool()
     reader = LayoutTestResultsReader(tool, "/var/logs")
     results_path = '/mock-results/results.html'
     tool.filesystem = MockFileSystem({results_path: None})
     # Make sure that our filesystem mock functions as we expect.
     self.assertRaises(IOError, tool.filesystem.read_text_file, results_path)
     # layout_test_results shouldn't raise even if the results.html file is missing.
     self.assertEquals(reader.results(), None)
예제 #3
0
 def test_missing_layout_test_results(self):
     queue = CommitQueue()
     tool = MockTool()
     results_path = '/mock/results.html'
     tool.filesystem = MockFileSystem({results_path: None})
     queue.bind_to_tool(tool)
     # Make sure that our filesystem mock functions as we expect.
     self.assertRaises(IOError, tool.filesystem.read_text_file, results_path)
     # layout_test_results shouldn't raise even if the results.html file is missing.
     self.assertEquals(queue.layout_test_results(), None)
예제 #4
0
    def test_report_flaky_tests_creating_bug(self):
        tool = MockTool()
        tool.filesystem = MockFileSystem(
            {"/mock-results/foo/bar-diffs.txt": "mock"})
        reporter = FlakyTestReporter(tool, 'dummy-queue')
        reporter._lookup_bug_for_flaky_test = lambda bug_id: None
        patch = tool.bugs.fetch_attachment(10000)

        test_results = [self._mock_test_result('foo/bar.html')]

        class MockZipFile(object):
            def read(self, path):
                return ""

            def namelist(self):
                return ['foo/bar-diffs.txt']

        with OutputCapture(level=logging.INFO) as captured:
            reporter.report_flaky_tests(patch, test_results, MockZipFile())

        self.assertEqual(
            captured.root.log.getvalue(),
            """Bug does not already exist for foo/bar.html, creating.
MOCK create_bug
bug_title: Flaky Test: foo/bar.html
bug_description: This is an automatically generated bug from the dummy-queue.
foo/bar.html has been flaky on the dummy-queue.

foo/bar.html was authored by [email protected].
https://trac.webkit.org/browser/trunk/LayoutTests/foo/bar.html

The dummy-queue just saw foo/bar.html flake (text diff) while processing attachment 10000 on bug 50000.
Port: MockPort  Platform: MockPlatform 1.0

The bots will update this with information from each new failure.

If you believe this bug to be fixed or invalid, feel free to close.  The bots will re-open if the flake re-occurs.

If you would like to track this test fix with another bug, please close this bug as a duplicate.  The bots will follow the duplicate chain when making future comments.

component: Tools / Tests
cc: [email protected]
blocked: 50856
MOCK add_attachment_to_bug: bug_id=60001, description=Failure diff from bot filename=failure.diff mimetype=None
MOCK bug comment: bug_id=50000, cc=None, see_also=None
--- Begin comment ---
The dummy-queue encountered the following flaky tests while processing attachment 10000:

foo/bar.html bug 60001 (author: [email protected])
The dummy-queue is continuing to process your patch.
--- End comment ---

""",
        )
예제 #5
0
 def test_missing_layout_test_results(self):
     queue = CommitQueue()
     tool = MockTool()
     results_path = '/mock/results.html'
     tool.filesystem = MockFileSystem({results_path: None})
     queue.bind_to_tool(tool)
     # Make sure that our filesystem mock functions as we expect.
     self.assertRaises(IOError, tool.filesystem.read_text_file,
                       results_path)
     # layout_test_results shouldn't raise even if the results.html file is missing.
     self.assertEquals(queue.layout_test_results(), None)
예제 #6
0
 def test_missing_layout_test_results(self):
     tool = MockTool()
     reader = LayoutTestResultsReader(tool, "/var/logs")
     layout_tests_results_path = '/mock-results/full_results.json'
     unit_tests_results_path = '/mock-results/webkit_unit_tests_output.xml'
     tool.filesystem = MockFileSystem({layout_tests_results_path: None,
                                       unit_tests_results_path: None})
     # Make sure that our filesystem mock functions as we expect.
     self.assertRaises(IOError, tool.filesystem.read_text_file, layout_tests_results_path)
     self.assertRaises(IOError, tool.filesystem.read_text_file, unit_tests_results_path)
     # layout_test_results shouldn't raise even if the results.json file is missing.
     self.assertEqual(reader.results(), None)
예제 #7
0
    def test_report_flaky_tests_creating_bug(self):
        tool = MockTool()
        tool.filesystem = MockFileSystem(
            {"/mock-results/foo/bar-diffs.txt": "mock"})
        tool.status_server = MockStatusServer(bot_id="mock-bot-id")
        reporter = FlakyTestReporter(tool, 'dummy-queue')
        reporter._lookup_bug_for_flaky_test = lambda bug_id: None
        patch = tool.bugs.fetch_attachment(10000)
        expected_stderr = """MOCK create_bug
bug_title: Flaky Test: foo/bar.html
bug_description: This is an automatically generated bug from the dummy-queue.
foo/bar.html has been flaky on the dummy-queue.

foo/bar.html was authored by [email protected].
http://trac.webkit.org/browser/trunk/LayoutTests/foo/bar.html

The dummy-queue just saw foo/bar.html flake (Text diff mismatch) while processing attachment 10000 on bug 50000.
Bot: mock-bot-id  Port: MockPort  Platform: MockPlatform 1.0

The bots will update this with information from each new failure.

If you believe this bug to be fixed or invalid, feel free to close.  The bots will re-open if the flake re-occurs.

If you would like to track this test fix with another bug, please close this bug as a duplicate.  The bots will follow the duplicate chain when making future comments.

component: Tools / Tests
cc: [email protected]
blocked: 50856
MOCK add_attachment_to_bug: bug_id=50004, description=Failure diff from mock-bot-id filename=failure.diff
MOCK bug comment: bug_id=50000, cc=None
--- Begin comment ---
The dummy-queue encountered the following flaky tests while processing attachment 10000:

foo/bar.html bug 50004 (author: [email protected])
The dummy-queue is continuing to process your patch.
--- End comment ---

"""
        test_results = [self._mock_test_result('foo/bar.html')]

        class MockZipFile(object):
            def read(self, path):
                return ""

            def namelist(self):
                return ['foo/bar-diffs.txt']

        OutputCapture().assert_outputs(
            self,
            reporter.report_flaky_tests,
            [patch, test_results, MockZipFile()],
            expected_stderr=expected_stderr)
    def test_create_unit_test_results(self):
        tool = MockTool()
        reader = LayoutTestResultsReader(tool, "/var/logs")
        unit_tests_results_path = '/mock-results/webkit_unit_tests_output.xml'
        no_failures_xml = """<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3" failures="0" disabled="0" errors="0" time="11.35" name="AllTests">
  <testsuite name="RenderTableCellDeathTest" tests="3" failures="0" disabled="0" errors="0" time="0.677">
    <testcase name="CanSetColumn" status="run" time="0.168" classname="RenderTableCellDeathTest" />
    <testcase name="CrashIfSettingUnsetColumnIndex" status="run" time="0.129" classname="RenderTableCellDeathTest" />
    <testcase name="CrashIfSettingUnsetRowIndex" status="run" time="0.123" classname="RenderTableCellDeathTest" />
  </testsuite>
</testsuites>"""
        tool.filesystem = MockFileSystem({unit_tests_results_path: no_failures_xml})
        self.assertEqual(reader._create_unit_test_results(), [])
예제 #9
0
    def test_create_unit_test_results(self):
        tool = MockTool()
        reader = LayoutTestResultsReader(tool, "/var/logs")
        unit_tests_results_path = '/mock-results/webkit_unit_tests_output.xml'
        no_failures_xml = """<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3" failures="0" disabled="0" errors="0" time="11.35" name="AllTests">
  <testsuite name="RenderTableCellDeathTest" tests="3" failures="0" disabled="0" errors="0" time="0.677">
    <testcase name="CanSetColumn" status="run" time="0.168" classname="RenderTableCellDeathTest" />
    <testcase name="CrashIfSettingUnsetColumnIndex" status="run" time="0.129" classname="RenderTableCellDeathTest" />
    <testcase name="CrashIfSettingUnsetRowIndex" status="run" time="0.123" classname="RenderTableCellDeathTest" />
  </testsuite>
</testsuites>"""
        tool.filesystem = MockFileSystem(
            {unit_tests_results_path: no_failures_xml})
        self.assertEquals(reader._create_unit_test_results(), [])
예제 #10
0
    def test_report_flaky_tests_creating_bug(self):
        tool = MockTool()
        tool.filesystem = MockFileSystem({"/mock-results/foo/bar-diffs.txt": "mock"})
        tool.status_server = MockStatusServer(bot_id="mock-bot-id")
        reporter = FlakyTestReporter(tool, 'dummy-queue')
        reporter._lookup_bug_for_flaky_test = lambda bug_id: None
        patch = tool.bugs.fetch_attachment(10000)
        expected_logs = """Bug does not already exist for foo/bar.html, creating.
MOCK create_bug
bug_title: Flaky Test: foo/bar.html
bug_description: This is an automatically generated bug from the dummy-queue.
foo/bar.html has been flaky on the dummy-queue.

foo/bar.html was authored by [email protected].
http://trac.webkit.org/browser/trunk/LayoutTests/foo/bar.html

The dummy-queue just saw foo/bar.html flake (text diff) while processing attachment 10000 on bug 50000.
Bot: mock-bot-id  Port: MockPort  Platform: MockPlatform 1.0

The bots will update this with information from each new failure.

If you believe this bug to be fixed or invalid, feel free to close.  The bots will re-open if the flake re-occurs.

If you would like to track this test fix with another bug, please close this bug as a duplicate.  The bots will follow the duplicate chain when making future comments.

component: Tools / Tests
cc: [email protected]
blocked: 50856
MOCK add_attachment_to_bug: bug_id=60001, description=Failure diff from mock-bot-id filename=failure.diff mimetype=None
MOCK bug comment: bug_id=50000, cc=None
--- Begin comment ---
The dummy-queue encountered the following flaky tests while processing attachment 10000:

foo/bar.html bug 60001 (author: [email protected])
The dummy-queue is continuing to process your patch.
--- End comment ---

"""
        test_results = [self._mock_test_result('foo/bar.html')]

        class MockZipFile(object):
            def read(self, path):
                return ""

            def namelist(self):
                return ['foo/bar-diffs.txt']

        OutputCapture().assert_outputs(self, reporter.report_flaky_tests, [patch, test_results, MockZipFile()], expected_logs=expected_logs)
    def test_archive_last_layout_test_results(self):
        tool = MockTool()
        reader = LayoutTestResultsReader(tool, "/var/logs")
        patch = tool.bugs.fetch_attachment(10001)
        tool.filesystem = MockFileSystem()
        # Should fail because the results_directory does not exist.
        expected_stderr = "/mock-results does not exist, not archiving.\n"
        archive = OutputCapture().assert_outputs(self, reader.archive, [patch], expected_stderr=expected_stderr)
        self.assertEqual(archive, None)

        results_directory = "/mock-results"
        # Sanity check what we assume our mock results directory is.
        self.assertEqual(reader._results_directory(), results_directory)
        tool.filesystem.maybe_make_directory(results_directory)
        self.assertTrue(tool.filesystem.exists(results_directory))

        self.assertNotEqual(reader.archive(patch), None)
        self.assertFalse(tool.filesystem.exists(results_directory))
    def test_archive_last_layout_test_results(self):
        tool = MockTool()
        reader = LayoutTestResultsReader(tool, "/var/logs")
        patch = tool.bugs.fetch_attachment(128)
        tool.filesystem = MockFileSystem()
        # Should fail because the results_directory does not exist.
        expected_stderr = "/mock-results does not exist, not archiving.\n"
        archive = OutputCapture().assert_outputs(self, reader.archive, [patch], expected_stderr=expected_stderr)
        self.assertEqual(archive, None)

        results_directory = "/mock-results"
        # Sanity check what we assume our mock results directory is.
        self.assertEqual(reader._results_directory(), results_directory)
        tool.filesystem.maybe_make_directory(results_directory)
        self.assertTrue(tool.filesystem.exists(results_directory))

        self.assertNotEqual(reader.archive(patch), None)
        self.assertFalse(tool.filesystem.exists(results_directory))
예제 #13
0
    def test_report_flaky_tests_creating_bug(self):
        tool = MockTool()
        tool.filesystem = MockFileSystem({"/mock/foo/bar-diffs.txt": "mock"})
        tool.status_server = MockStatusServer(bot_id="mock-bot-id")
        reporter = FlakyTestReporter(tool, 'dummy-queue')
        reporter._lookup_bug_for_flaky_test = lambda bug_id: None
        patch = tool.bugs.fetch_attachment(197)
        expected_stderr = """MOCK create_bug
bug_title: Flaky Test: foo/bar.html
bug_description: This is an automatically generated bug from the dummy-queue.
foo/bar.html has been flaky on the dummy-queue.

foo/bar.html was authored by [email protected].
http://trac.webkit.org/browser/trunk/LayoutTests/foo/bar.html

The dummy-queue just saw foo/bar.html flake while processing attachment 197 on bug 42.
Bot: mock-bot-id  Port: MockPort  Platform: MockPlatform 1.0

The bots will update this with information from each new failure.

If you believe this bug to be fixed or invalid, feel free to close.  The bots will re-open if the flake re-occurs.

If you would like to track this test fix with another bug, please close this bug as a duplicate.  The bots will follow the duplicate chain when making future comments.

component: Tools / Tests
cc: [email protected]
blocked: 50856
MOCK add_attachment_to_bug: bug_id=78, description=Failure diff from mock-bot-id filename=failure.diff
MOCK bug comment: bug_id=42, cc=None
--- Begin comment ---
The dummy-queue encountered the following flaky tests while processing attachment 197:

foo/bar.html bug 78 (author: [email protected])
The dummy-queue is continuing to process your patch.
--- End comment ---

"""
        OutputCapture().assert_outputs(self, reporter.report_flaky_tests, [['foo/bar.html'], patch], expected_stderr=expected_stderr)