[ARVADOS] updated: 22e1fd1a6ef65e6cdcb58cba48657497b9e37be9
git at public.curoverse.com
git at public.curoverse.com
Fri Aug 21 11:36:09 EDT 2015
Summary of changes:
sdk/python/tests/test_init.py | 67 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 66 insertions(+), 1 deletion(-)
via 22e1fd1a6ef65e6cdcb58cba48657497b9e37be9 (commit)
from a6e5b740e7619a266c1e76b0ddbba943038c1efb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 22e1fd1a6ef65e6cdcb58cba48657497b9e37be9
Author: Bryan Cosca <bcosc at curoverse.com>
Date: Fri Aug 21 11:36:02 2015 -0400
6600: Added pseudocode as test infrastructure
diff --git a/sdk/python/tests/test_init.py b/sdk/python/tests/test_init.py
index fcb7f30..98bc43e 100644
--- a/sdk/python/tests/test_init.py
+++ b/sdk/python/tests/test_init.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python
import mock
import os
@@ -22,6 +22,71 @@ class SDKTestCase(unittest.TestCase, tutil.ApiClientMock):
arvados.task_set_output({'uuid':'zzzzz-zzzzz-zzzzzzzzzzzzzzz'},s='7idummyhashb0b1f1f03e4e6f69c4a4e+28243',api_client=api_client)
self.assertEqual(err_check,False) # Need a spy assert to see why ApiError/HttpError isn't getting called
+########## Psuedocode work start ##########
+
+# Add mock_api_responses to tutil
+
+ at tutil.skip_sleep
+class TaskSetOutputTests:
+
+ api_client=mock.MagicMock()
+
+ def check_for_errors(self, errors*,num_retries,api_client):
+ with req_mock, self.assertRaises(all_errors) as err_check: # look for all errors using calls
+ arvados.task_set_output({'uuid':'zzzzz-zzzzz-zzzzzzzzzzzzzzz'},s='7idummyhashb0b1f1f03e4e6f69c4a4e+28243',api_client=api_client,num_retries=2)
+ self.assertEqual(err_check,errors*,True) # Spy to check to see if you asserted the right errors
+ self.assertTrue(num_retries_needed=num_retries) # Spy to check to see if you asserted the correct num_retries
+
+ def test_task_set_output_zero_retries_success(self,api_client=api_client):
+ req_mock = tutil.mock_api_responses('', 200) # Mock a 200 call
+ self.assertTrue(check_for_errors('Success', 0, api_client)
+
+ def test_task_set_output_zero_retries_tempfail(self,api_client=api_client):
+ req_mock = tutil.mock_api_responses('', 500) # Mock a 500 call
+ self.assertTrue(check_for_errors('Success', 0, api_client)
+
+ def test_task_set_output_zero_retries_permfail(self,api_client=api_client):
+ req_mock = tutil.mock_api_responses('', 404) # Mock a 404 call
+ self.assertTrue(check_for_errors('PermFail', 0, api_client))
+
+ def test_task_set_output_zero_retries_permfail(self,api_client=api_client):
+ req_mock = tutil.mock_api_responses('', 200, 408) # Mock a 200, 408 call
+ self.assertTrue(check_for_errors('Success', 0, api_client))
+
+ def test_task_set_output_one_retry_success(self,api_client=api_client):
+ req_mock = tutil.mock_api_responses('', 500, 200) # Mock a 500, 200 call
+ self.assertTrue(check_for_errors('TempFail', 'Success', 1, api_client))
+
+ def test_task_set_output_one_retry_tempfail(self,api_client=api_client):
+ req_mock = tutil.mock_api_responses('', 500, 501) # Mock a 500, 501 call
+ self.assertTrue(check_for_errors('TempFail', 'TempFail', 1, api_client)
+
+ def test_task_set_output_one_retry_permfail(self):
+ req_mock = tutil.mock_api_responses('', 500, 404) # Mock a 500, 404 call
+ self.assertTrue(check_for_errors('TempFail', 'PermFail', 1, api_client))
+
+ def test_task_set_output_two_retries_success(self):
+ req_mock = tutil.mock_api_responses('', 500, 408, 200) # Mock a 500, 408, 200 call
+ self.assertTrue(check_for_errors('TempFail', 'TempFail', 'Success', 2, api_client))
+
+ def test_task_set_output_two_retries_permfail(self):
+ req_mock = tutil.mock_api_responses('', 500, 408, 404) # Mock a 500, 408, 404 call
+ self.assertTrue(check_for_errors('TempFail', 'TempFail', 'PermFail', 2, api_client))
+
+ def test_task_set_output_two_retries_success_after_one(self):
+ req_mock = tutil.mock_api_responses('', 500, 200, 500) # Mock a 500, 200, 500 call
+ self.assertTrue(check_for_errors('TempFail', 'Success', 1, api_client))
+
+ def test_task_set_output_two_retries_forever_tempfail(self):
+ req_mock = tutil.mock_api_responses('', 500, 508, 501) # Mock a 500, 200, 500 call
+ self.assertTrue(check_for_errors('TempFail', 'TempFail', 'TempFail', 1, api_client))
+
+
+
+
+########## Psuedocode work end ##########
+
+
#with tutil.mock_keep_responses('foo', 500, 500, 403, 403):
# arvados.task_set_output({'uuid':'zzzzz-zzzzz-zzzzzzzzzzzzzzz'},s='7idummyhashb0b1f1f03e4e6f69c4a4e+28243',api_client=api_client)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list