-
Notifications
You must be signed in to change notification settings - Fork 233
Allow 'new_clusters' key in 'jobs reset' option to mimic JSON API pay… #524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow 'new_clusters' key in 'jobs reset' option to mimic JSON API pay… #524
Conversation
Codecov Report
@@ Coverage Diff @@
## main #524 +/- ##
==========================================
+ Coverage 60.93% 60.95% +0.02%
==========================================
Files 55 55
Lines 4669 4672 +3
==========================================
+ Hits 2845 2848 +3
Misses 1824 1824
Continue to review full report at Codecov.
|
pietern
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@janvandervegt Thanks for the PR, looks reasonable. Please check out the comments.
| RESET_JSON = '{"job_name": "test_job"}' | ||
|
|
||
| CORRECT_RESPONSE = {'job_id': 1, | ||
| 'new_settings': json.loads(RESET_JSON)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be CORRECT_REQUEST_PAYLOAD if I'm reading the test correctly.
| assert jobs_api_mock.reset_job.call_args[0][0] == CORRECT_RESPONSE | ||
|
|
||
|
|
||
| RESET_JSON_NEW_SETTINGS = '{"new_settings": {"job_name": "test_job"}}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use RESET_JSON to avoid duplication.
| } | ||
| if 'new_settings' in deser_json: | ||
| request_body = deser_json | ||
| request_body['job_id'] = job_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about checking for new_clusters as the title implies? If you specify a dict with only that key, it would be wrapped in the new_settings field in the else branch. I suspect you may need to check for more than just the new_settings key here to determine what is actually specified.
|
Resolved by #582. |
Added check for 'new_clusters' key so that the regular JSON payload for the reset endpoint is also accepted