Skip to content

Commit

Permalink
Fix timeout window tests (derp)
Browse files Browse the repository at this point in the history
  • Loading branch information
kolanos committed Jun 7, 2019
1 parent 061e742 commit 90c1898
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def _handler_that_errors(event, context):
def handler_that_timeouts(iopipe):
@iopipe.decorator
def _handler_that_timeouts(event, context):
time.sleep(2)
time.sleep(1)
raise Exception("Should timeout before this is raised")

return iopipe, _handler_that_timeouts
Expand Down
6 changes: 3 additions & 3 deletions tests/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_erroring(mock_send_report, handler_that_errors, mock_context):
def test_timeouts(mock_send_report, handler_that_timeouts, mock_context):
"""Assert that the agent timeouts before function does"""
iopipe, handler = handler_that_timeouts
mock_context.set_remaining_time_in_millis(1000)
mock_context.set_remaining_time_in_millis(500)

try:
handler(None, mock_context)
Expand All @@ -98,8 +98,8 @@ def test_timeouts_disable(mock_send_report, handler_that_timeouts, mock_context)
"""Assert the timeout is disabled if insufficient time remaining"""
iopipe, handler = handler_that_timeouts

# The default is 0.5, so 500 / 1000 - 0.5 = 0
mock_context.set_remaining_time_in_millis(500)
# The default is 0.15, so 150 / 1000 - 0.15 = 0
mock_context.set_remaining_time_in_millis(150)

try:
handler(None, mock_context)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_set_config__iopipe_timeout_window(monkeypatch):
os, "getenv", partial(mock_getenv, "IOPIPE_TIMEOUT_WINDOW", "not a number")
)
config = set_config()
assert config["timeout_window"] == 0.5
assert config["timeout_window"] == 0.15


def test_set_config__iopipe_token(monkeypatch):
Expand Down

0 comments on commit 90c1898

Please sign in to comment.