Title: [288958] trunk/Tools
Revision
288958
Author
[email protected]
Date
2022-02-02 10:03:05 -0800 (Wed, 02 Feb 2022)

Log Message

[EWS] unit tests have become slower
https://bugs.webkit.org/show_bug.cgi?id=235364
<rdar://problem/88073408>

Reviewed by Aakash Jain.

* Tools/CISupport/ews-build/steps_unittest.py: Mock
time.sleep when testing PushCommitToWebKitRepo.

Canonical link: https://commits.webkit.org/246687@main

Modified Paths

Diff

Modified: trunk/Tools/CISupport/ews-build/steps_unittest.py (288957 => 288958)


--- trunk/Tools/CISupport/ews-build/steps_unittest.py	2022-02-02 17:54:16 UTC (rev 288957)
+++ trunk/Tools/CISupport/ews-build/steps_unittest.py	2022-02-02 18:03:05 UTC (rev 288958)
@@ -4931,8 +4931,13 @@
             )
         )
 
+    @classmethod
+    def mock_sleep(cls):
+        return patch('time.sleep', lambda _: None)
+
+
     def test_success(self):
-        with self.mock_commits_webkit_org(identifier='220797@main'):
+        with self.mock_commits_webkit_org(identifier='220797@main'), self.mock_sleep():
             self.setupStep(PushCommitToWebKitRepo())
             self.setProperty('patch_id', '1234')
             self.expectRemoteCommands(
@@ -4952,7 +4957,7 @@
             return rc
 
     def test_success_no_identifier(self):
-        with self.mock_commits_webkit_org():
+        with self.mock_commits_webkit_org(), self.mock_sleep():
             self.setupStep(PushCommitToWebKitRepo())
             self.setProperty('patch_id', '1234')
             self.expectRemoteCommands(
@@ -4972,42 +4977,44 @@
             return rc
 
     def test_failure_retry(self):
-        self.setupStep(PushCommitToWebKitRepo())
-        self.setProperty('patch_id', '2345')
-        self.expectRemoteCommands(
-            ExpectShell(workdir='wkdir',
-                        timeout=300,
-                        logEnviron=False,
-                        command=['git', 'svn', 'dcommit', '--rmdir']) +
-            ExpectShell.log('stdio', stdout='Unexpected failure') +
-            2,
-        )
-        self.expectOutcome(result=FAILURE, state_string='Failed to push commit to Webkit repository')
-        with current_hostname(EWS_BUILD_HOSTNAME):
-            rc = self.runStep()
-        self.assertEqual(self.getProperty('retry_count'), 1)
-        self.assertEqual(self.getProperty('build_finish_summary'), None)
-        self.assertEqual(self.getProperty('bugzilla_comment_text'), None)
-        return rc
+        with self.mock_sleep():
+            self.setupStep(PushCommitToWebKitRepo())
+            self.setProperty('patch_id', '2345')
+            self.expectRemoteCommands(
+                ExpectShell(workdir='wkdir',
+                            timeout=300,
+                            logEnviron=False,
+                            command=['git', 'svn', 'dcommit', '--rmdir']) +
+                ExpectShell.log('stdio', stdout='Unexpected failure') +
+                2,
+            )
+            self.expectOutcome(result=FAILURE, state_string='Failed to push commit to Webkit repository')
+            with current_hostname(EWS_BUILD_HOSTNAME):
+                rc = self.runStep()
+            self.assertEqual(self.getProperty('retry_count'), 1)
+            self.assertEqual(self.getProperty('build_finish_summary'), None)
+            self.assertEqual(self.getProperty('bugzilla_comment_text'), None)
+            return rc
 
     def test_failure(self):
-        self.setupStep(PushCommitToWebKitRepo())
-        self.setProperty('retry_count', PushCommitToWebKitRepo.MAX_RETRY)
-        self.setProperty('patch_id', '2345')
-        self.expectRemoteCommands(
-            ExpectShell(workdir='wkdir',
-                        timeout=300,
-                        logEnviron=False,
-                        command=['git', 'svn', 'dcommit', '--rmdir']) +
-            ExpectShell.log('stdio', stdout='Unexpected failure') +
-            2,
-        )
-        self.expectOutcome(result=FAILURE, state_string='Failed to push commit to Webkit repository')
-        with current_hostname(EWS_BUILD_HOSTNAME):
-            rc = self.runStep()
-        self.assertEqual(self.getProperty('build_finish_summary'), 'Failed to commit to WebKit repository')
-        self.assertEqual(self.getProperty('bugzilla_comment_text'), 'commit-queue failed to commit attachment 2345 to WebKit repository. To retry, please set cq+ flag again.')
-        return rc
+        with self.mock_sleep():
+            self.setupStep(PushCommitToWebKitRepo())
+            self.setProperty('retry_count', PushCommitToWebKitRepo.MAX_RETRY)
+            self.setProperty('patch_id', '2345')
+            self.expectRemoteCommands(
+                ExpectShell(workdir='wkdir',
+                            timeout=300,
+                            logEnviron=False,
+                            command=['git', 'svn', 'dcommit', '--rmdir']) +
+                ExpectShell.log('stdio', stdout='Unexpected failure') +
+                2,
+            )
+            self.expectOutcome(result=FAILURE, state_string='Failed to push commit to Webkit repository')
+            with current_hostname(EWS_BUILD_HOSTNAME):
+                rc = self.runStep()
+            self.assertEqual(self.getProperty('build_finish_summary'), 'Failed to commit to WebKit repository')
+            self.assertEqual(self.getProperty('bugzilla_comment_text'), 'commit-queue failed to commit attachment 2345 to WebKit repository. To retry, please set cq+ flag again.')
+            return rc
 
 
 class TestShowIdentifier(BuildStepMixinAdditions, unittest.TestCase):

Modified: trunk/Tools/ChangeLog (288957 => 288958)


--- trunk/Tools/ChangeLog	2022-02-02 17:54:16 UTC (rev 288957)
+++ trunk/Tools/ChangeLog	2022-02-02 18:03:05 UTC (rev 288958)
@@ -1,3 +1,14 @@
+2022-02-02  Jonathan Bedard  <[email protected]>
+
+        [EWS] unit tests have become slower
+        https://bugs.webkit.org/show_bug.cgi?id=235364
+        <rdar://problem/88073408>
+
+        Reviewed by Aakash Jain.
+
+        * CISupport/ews-build/steps_unittest.py: Mock
+        time.sleep when testing PushCommitToWebKitRepo.
+
 2022-02-02  Youenn Fablet  <[email protected]>
 
         Clarify that some UUID routines are dedicated to UUID v4
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to