Skip to content

Commit

Permalink
Adjust event streams refresh unit testing to address flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
jshcodes committed Oct 28, 2024
1 parent 9b32a24 commit 8704271
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions tests/test_event_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@ def stream_refresh():
avail["body"]["resources"][0]["sessionToken"]["token"]
), 'Date': current_time, 'Connection': 'Keep-Alive'
}
stream = requests.get(avail["body"]["resources"][0]["dataFeedURL"], headers=headers, stream=True)
with stream:
result = falcon.refreshActiveStreamSession(app_id=f"{APP_ID}",
action_name="refresh_active_stream_session",
partition=0
)
return bool(result["status_code"] in AllowedResponses)
if avail["body"]["resources"]:
stream = requests.get(avail["body"]["resources"][0]["dataFeedURL"], headers=headers, stream=True)
with stream:
result = falcon.refreshActiveStreamSession(app_id=f"{APP_ID}",
action_name="refresh_active_stream_session",
partition=0
)
return bool(result["status_code"] in AllowedResponses)
else:
pytest.skip("Rate limited")

@staticmethod
def stream_refresh_default_action():
Expand All @@ -63,13 +66,15 @@ def stream_refresh_default_action():
avail["body"]["resources"][0]["sessionToken"]["token"]
), 'Date': current_time, 'Connection': 'Keep-Alive'
}
stream = requests.get(avail["body"]["resources"][0]["dataFeedURL"], headers=headers, stream=True)
with stream:
result = falcon.refreshActiveStreamSession(appId=f"{APP_ID}",
partition="0"
)
return bool(result["status_code"] in AllowedResponses)

if avail["body"]["resources"]:
stream = requests.get(avail["body"]["resources"][0]["dataFeedURL"], headers=headers, stream=True)
with stream:
result = falcon.refreshActiveStreamSession(appId=f"{APP_ID}",
partition="0"
)
return bool(result["status_code"] in AllowedResponses)
else:
pytest.skip("Rate limited")

@staticmethod
def stream_errors():
Expand Down

0 comments on commit 8704271

Please sign in to comment.