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

chore: Follow-up to Mockery followup #288

Merged
merged 5 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .mockery.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
with-expecter: true
disable-version-string: true
dir: ../mockadmin
dir: mockadmin
outpkg: mockadmin
filename: "{{ .InterfaceName | snakecase }}.go"
mockname: "{{.InterfaceName}}"
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Repository contains following SDKs
- `tools`: tooling used to generate Atlas Admin SDK. See [./tools](./tools) for more information.
- `examples`: SDK examples
- `internal`: folder for hosting non user facing SDK methods and core helpers
- `mockadmin`: [Testify mocks](https://pkg.go.dev/github.com/stretchr/testify/mock) generated with [Mockery](https://github.com/vektra/mockery) for API interfaces
Copy link
Member

@wtrocki wtrocki Mar 25, 2024

Choose a reason for hiding this comment

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

IMHO we might need documentation that clarifies how we maintain mockery as part of the SDK.
Defining make target to regenerate locally and pointing to the tests example


## VSCode debugging configuration
VSCode developers might use following debugging configuration for transformer and go debugging
Expand Down
4 changes: 1 addition & 3 deletions tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,4 @@ update-version:

.PHONY: generate_mocks
generate_mocks:
go install github.com/vektra/mockery/v2@v2.42.1
rm -Rf ../mockadmin
mockery
./scripts/generate_mocks.sh
Copy link
Member

Choose a reason for hiding this comment

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

❤️ Nice!

9 changes: 9 additions & 0 deletions tools/scripts/generate_mocks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
rm -Rf ../mockadmin

# install only if not already present
if ! which mockery ; then
docker run --rm -v "$(dirname "$PWD")":/src --workdir=/src vektra/mockery:v2.42.1
else
mockery --dir ../mockadmin
fi