Flaky unit test - instructor cannot remove section owner #58358
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: The unit test instructor_cannot_remove_section_owner would intermittently fail because the assertion for deletion would return HTTP 204 No Content instead of HTTP 403 Forbidden.
Root cause:
code-dot-org/dashboard/app/controllers/api/v1/json_api_controller.rb
Line 1 in 1f8d782
So, although the request was returning HTTP 403, it wasn't exercising the authorization code path and was succeeding because the record wasn't found. In those intermittent cases, my guess is, there was a valid section_instructor record with the same ID as the instructor ID, and was successfully deleted. Don't have logs to confirm this theory though.
Links
JIRA: https://codedotorg.atlassian.net/browse/TEACH-1031
Testing story
Deployment strategy
Regular DTP
Follow-up work
None
Privacy
N/A
Security
N/A
Caching
N/A
PR Checklist: