Rescue the exception when the logout link is not found
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 3
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
When the logout link is found we get the following error:
[2021-07-07 20:31:19,311] j13/ERROR/locust.user.task: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/locust/user/task.py", line 290, in run
self.execute_next_task()
File "/usr/local/lib/python3.9/site-packages/locust/user/task.py", line 315, in execute_next_task
self.execute_task(self._task_queue.pop(0))
File "/usr/local/lib/python3.9/site-packages/locust/user/task.py", line 327, in execute_task
task(self)
File "/Users/jjg/Documents/sources/login/identity-loadtest/load_testing/sp_sign_in.locustfile.py", line 9, in sp_sign_in_load_test
flow_sp_sign_in.do_sign_in(self)
File "/Users/jjg/Documents/sources/login/identity-loadtest/load_testing/common_flows/flow_sp_sign_in.py", line 136, in do_sign_in
logout_link = sp_signout_link(resp)
File "/Users/jjg/Documents/sources/login/identity-loadtest/load_testing/common_flows/flow_helper.py", line 164, in sp_signout_link
if "/logout" not in href:
TypeError: argument of type 'NoneType' is not iterable
We should rescue from that exception so that locust can record that as a failure.
We ran into this issue before: https://gsa-tts.slack.com/archives/C010L0SE4E8/p1586795114166400
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in load_testing/common_flows/flow_helper.py at sp_signout_link, using the traceback to inspect the NoneType failure around the logout-link check. Then review load_testing/common_flows/flow_sp_sign_in.py at do_sign_in and verify that the failure is recorded by Locust rather than escaping as an unhandled exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100