Skip to content

Rewind API #163

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

Merged
merged 11 commits into from
Sep 14, 2020
Merged

Rewind API #163

merged 11 commits into from
Sep 14, 2020

Conversation

davidmrdavid
Copy link
Collaborator

@davidmrdavid davidmrdavid commented Jul 15, 2020

Implements the Rewind API for Python. Also adds unit tests equivalent to those in JS, found here.

@cgillum cgillum marked this pull request as draft July 17, 2020 01:08
@davidmrdavid davidmrdavid changed the title WIP: rewind Rewind API Sep 11, 2020
@davidmrdavid davidmrdavid marked this pull request as ready for review September 11, 2020 17:25
@cgillum cgillum requested a review from wenhzha September 11, 2020 18:46
Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change itself looks good for merging. One note about the amount of code we write/maintain for these APIs moving forward.

Copy link

@ConnorMcMahon ConnorMcMahon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good after addressing a couple of nits.


request_url = f"{self._orchestration_bindings.rpc_base_url}" + path
else:
raise Exception("The Python SDK only supports RPC endpoints.")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could slightly clarify this by specifying what host.json settings need to be removed (i.e. localRpcEnabled)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 - it's best to make exception messages like this actionable when possible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I'm usually of this mindset, I just did not know myself what to disable/enable in host.json. I'll write something up with this!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

for code in [200, 202]:
mock_request = MockRequest(
expected_url=f"{RPC_BASE_URL}instances/{INSTANCE_ID}/rewind?reason={REASON}",
response=[202, ""])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should this line be response=[code,""])

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, silly me. That's a refactor gone wrong, thank you!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if you could just adjust that error message per Connor's feedback.


@pytest.mark.asyncio
async def test_rewind_with_no_rpc_endpoint(binding_string):
"""Tests the behaviour of rewind without an RPC endpoint / under the legacy HTTP enepoin5."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"enepoin5" :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh no. That's embarrassing. Sorry!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@davidmrdavid
Copy link
Collaborator Author

@ConnorMcMahon , @cgillum
I think it's ready to go, after addressing PR feedback (thank you!). I'd appreciate one final LGTM!

Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Copy link

@ConnorMcMahon ConnorMcMahon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@davidmrdavid davidmrdavid merged commit 65188f2 into dev Sep 14, 2020
@davidmrdavid davidmrdavid deleted the dajustp/rewind branch March 9, 2021 18:15
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