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

Expose more protobuf structs to make transactions testable and mockable #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

g-murzik
Copy link
Contributor

Hi David,

I already had the feeling that the last PR related to mocking (#23) did not expose everything related to it. It turns out that a few more changes are required in order to test / mock transactions, which are of course crucial for more complex services leveraging etcd_client.

This PR enables the following actions by exposing just a few more protobuf structs:

  • Convert the txn parameter passed to etcd_client::KvClient::txn into a PbTxnRequest and check that the right transaction conditions, success, and failure operations are used.
  • Construct (and return) nested transaction responses during mocking.

What do you think? Any feedback is highly appreciated. Thanks in advance!

This commit enables the following actions:
- Convert the `txn` parameter passed to `etcd_client::KvClient::txn`
  into a `PbTxnRequest` and check that the right transaction conditions,
  success, and failure operations are present.
- Construct (and return) nested transaction responses during mocking.
@diggyk
Copy link

diggyk commented Mar 19, 2022

I could use this as well. I was thinking we could also just #[derive(PartialEq)] since structs like Compare are just wrapping PbCompare, which does seem to already derive PartialEq

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.

2 participants