[ews-build] Add unit tests for DownloadBuiltProduct
authoraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Apr 2019 17:53:26 +0000 (17:53 +0000)
committeraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Apr 2019 17:53:26 +0000 (17:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197193

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-build/steps_unittest.py:
(TestDownloadBuiltProduct):
(TestDownloadBuiltProduct.setUp):
(TestDownloadBuiltProduct.tearDown):
(TestDownloadBuiltProduct.test_success):
(TestDownloadBuiltProduct.test_failure):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244548 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/BuildSlaveSupport/ews-build/steps_unittest.py
Tools/ChangeLog

index 806ff1c..3705559 100644 (file)
@@ -914,6 +914,48 @@ class TestUploadBuiltProduct(BuildStepMixinAdditions, unittest.TestCase):
         return self.runStep()
 
 
+class TestDownloadBuiltProduct(BuildStepMixinAdditions, unittest.TestCase):
+    def setUp(self):
+        self.longMessage = True
+        return self.setUpBuildStep()
+
+    def tearDown(self):
+        return self.tearDownBuildStep()
+
+    def test_success(self):
+        self.setupStep(DownloadBuiltProduct())
+        self.setProperty('platform', 'ios')
+        self.setProperty('fullPlatform', 'ios-simulator-12')
+        self.setProperty('configuration', 'release')
+        self.setProperty('architecture', 'x86_64')
+        self.setProperty('patch_id', '1234')
+        self.expectRemoteCommands(
+            ExpectShell(workdir='wkdir',
+                        command=['python', 'Tools/BuildSlaveSupport/download-built-product', '--platform=ios',  '--release', 'https://ews-build.webkit.org/archives/ios-simulator-12-x86_64-release/1234.zip'],
+                        )
+            + 0,
+        )
+        self.expectOutcome(result=SUCCESS, state_string='Downloaded built product')
+        return self.runStep()
+
+    def test_failure(self):
+        self.setupStep(DownloadBuiltProduct())
+        self.setProperty('platform', 'mac')
+        self.setProperty('fullPlatform', 'mac-sierra')
+        self.setProperty('configuration', 'debug')
+        self.setProperty('architecture', 'x86_64')
+        self.setProperty('patch_id', '123456')
+        self.expectRemoteCommands(
+            ExpectShell(workdir='wkdir',
+                        command=['python', 'Tools/BuildSlaveSupport/download-built-product', '--platform=mac',  '--debug', 'https://ews-build.webkit.org/archives/mac-sierra-x86_64-debug/123456.zip'],
+                        )
+            + ExpectShell.log('stdio', stdout='Unexpected failure.')
+            + 2,
+        )
+        self.expectOutcome(result=FAILURE, state_string='Downloaded built product (failure)')
+        return self.runStep()
+
+
 class TestExtractBuiltProduct(BuildStepMixinAdditions, unittest.TestCase):
     def setUp(self):
         self.longMessage = True
index 9f481a4..dcc4496 100644 (file)
@@ -1,5 +1,19 @@
 2019-04-23  Aakash Jain  <aakash_jain@apple.com>
 
+        [ews-build] Add unit tests for DownloadBuiltProduct
+        https://bugs.webkit.org/show_bug.cgi?id=197193
+
+        Reviewed by Lucas Forschler.
+
+        * BuildSlaveSupport/ews-build/steps_unittest.py:
+        (TestDownloadBuiltProduct):
+        (TestDownloadBuiltProduct.setUp):
+        (TestDownloadBuiltProduct.tearDown):
+        (TestDownloadBuiltProduct.test_success):
+        (TestDownloadBuiltProduct.test_failure):
+
+2019-04-23  Aakash Jain  <aakash_jain@apple.com>
+
         [ews-app] Exception while loading status-bubble when no build step has started
         https://bugs.webkit.org/show_bug.cgi?id=196676