Skip to content

Conversation

@janvandervegt-db
Copy link
Contributor

Added check for 'new_clusters' key so that the regular JSON payload for the reset endpoint is also accepted

@codecov-commenter
Copy link

codecov-commenter commented Jul 29, 2022

Codecov Report

Merging #524 (bc75718) into main (d7a9987) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            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              
Impacted Files Coverage Δ
databricks_cli/jobs/cli.py 96.68% <100.00%> (+0.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d7a9987...bc75718. Read the comment docs.

@fjakobs fjakobs requested a review from pietern July 29, 2022 11:20
Copy link
Contributor

@pietern pietern left a 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)}
Copy link
Contributor

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"}}'
Copy link
Contributor

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
Copy link
Contributor

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.

@pietern
Copy link
Contributor

pietern commented Nov 9, 2022

Resolved by #582.

@pietern pietern closed this Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants