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

refactor(GCS): Migrate to using mockery/testify #25

Merged
merged 4 commits into from
Dec 4, 2023

Conversation

Pokom
Copy link
Contributor

@Pokom Pokom commented Dec 1, 2023

This is my first attempt at using the mockery library to generate mocks. Previously we crafted our own mocks by hand for the GCS StorageClientInterface and hand wrote our own interceptors. I generated the mocked interfaces by running mockery locally. In order for mockery to recognize files, I had to create a main.go file in the root of the project. This newer way of running mockery requires you to generate mocks for all interfaces.

I updated the tests for buckets to use the new mocked interface. On Monday my plan is to extend the mocks and use testify to alter the behavior so I can do things like handle errors, and all of that fun stuff.

This is my first attempt at using the [mockery](https://vektra.github.io/mockery/latest/) library to generate mocks.
Previously we crafted our own mocks by hand for the GCS
StorageClientInterface and hand wrote our own interceptors. I generated
the mocked interfaces by running `mockery` locally.
In order for `mockery` to recognize files, I had to create a `main.go` file in the root of the project.
This newer way of running `mockery` requires you to generate mocks for
_all_ interfaces.

I updated the tests for buckets to use the new mocked interface.
On Monday my plan is to extend the mocks and use testify to alter the
behavior so I can do things like handle errors, and all of that fun
stuff.
@Pokom Pokom requested a review from skl December 1, 2023 20:57
@Pokom Pokom self-assigned this Dec 1, 2023
Copy link
Contributor

@skl skl left a comment

Choose a reason for hiding this comment

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

💯

@Pokom Pokom merged commit b5087da into main Dec 4, 2023
1 check passed
@Pokom Pokom deleted the refactor/gcp-gcs-mock-storage branch December 4, 2023 21:33
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