-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TDL-6829 added backoff for incompleteread error (#144)
* added backoff for incompleteread error * fixed pylint * bump version 1.7.4 --------- Co-authored-by: Rushikesh Todkar <[email protected]>
- Loading branch information
1 parent
6939afb
commit 1b26fbc
Showing
4 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from unittest import mock | ||
from tap_shopify.streams.base import http | ||
from tap_shopify.streams.transactions import Transactions | ||
import unittest | ||
|
||
class TestIncompleteReadBackoff(unittest.TestCase): | ||
@mock.patch("time.sleep") | ||
@mock.patch("pyactiveresource.activeresource.ActiveResource.find") | ||
def test_Transactions_pyactiveresource_error_incomplete_read_error_backoff(self, mocked_find, mocked_sleep): | ||
""" | ||
Test case to verify that we backoff for 5 times when 'http.client.IncompleteRead' error occurs | ||
""" | ||
# mock 'find' and raise IncompleteRead error | ||
mocked_find.side_effect = http.client.IncompleteRead(b'') | ||
# initialize class | ||
locations = Transactions() | ||
try: | ||
# function call | ||
locations.replication_object.find() | ||
except http.client.IncompleteRead: | ||
pass | ||
|
||
# verify we backoff 5 times | ||
self.assertEquals(mocked_find.call_count, 5) |