Skip to content
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

remove Buffer from Mock*Service #1440

Merged
merged 11 commits into from
Aug 12, 2022
Merged

remove Buffer from Mock*Service #1440

merged 11 commits into from
Aug 12, 2022

Conversation

Geal
Copy link
Contributor

@Geal Geal commented Jul 26, 2022

Fix #1435

Note: this does not fix this issue yet, because the service is isolated in a task, so any panic generated by mockall will stay in the task: it is fixed now:

tokio::spawn(async move {
loop {
while let Some((request, responder)) = handle.next_request().await {
match self.call(request) {
Ok(response) => responder.send_response(response),
Err(err) => responder.send_error(err),
}
}
}
});

@Geal Geal marked this pull request as draft July 26, 2022 15:02
@github-actions

This comment has been minimized.

Geoffroy Couprie added 3 commits August 8, 2022 15:51
the services based on tower-test were isolated in a task, which means
that any panic due to mockall would stay in that task and not affect the
rest of the tests.

This rewrites the mock service system to provide clonable mock services
that can panic
@Geal Geal changed the title remove Buffer from MockSubgraphService remove Buffer from Mock*Service Aug 8, 2022
@Geal Geal marked this pull request as ready for review August 8, 2022 15:02
Copy link
Contributor

@BrynCooke BrynCooke left a comment

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor

@o0Ignition0o o0Ignition0o left a comment

Choose a reason for hiding this comment

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

LGTM overall,

The only thing i m not comfortable with is the need for our plugin devs to call .expect_clone().

I think I'd even rather implement copy to our mocks to avoid having to do that.

WDYT is there a way we can get rid of this call?

@Geal
Copy link
Contributor Author

Geal commented Aug 12, 2022

it's not nice but AFAIK there is no way to just clone the expectations. And we can have different requirements depending on which instance of the service is called. I'd be open to a fix for that, but not in this PR: here I mainly want to have tests that work as expected

@Geal Geal enabled auto-merge (squash) August 12, 2022 11:58
@Geal Geal merged commit 4299585 into main Aug 12, 2022
@Geal Geal deleted the geal/remove-buffer-from-mocks branch August 12, 2022 13:46
@Geal Geal mentioned this pull request Aug 22, 2022
@Geal Geal self-assigned this Aug 24, 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.

remove Buffer from mocked services
4 participants