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

feat: migrate mocks to mockery #4688

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

feat: migrate mocks to mockery #4688

wants to merge 6 commits into from

Conversation

chenrui333
Copy link
Member

@chenrui333 chenrui333 commented Jun 19, 2024

fixes #4664

Copy link

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@james0209
Copy link
Contributor

james0209 commented Jun 20, 2024

If switching to Mockery, it's probably worth using the packages configuration scheme instead - the current draft PR implementation is deprecated.

https://vektra.github.io/mockery/latest/migrating_to_packages/

e.g. .mockery.yaml config for a separate mocks directory mirroring the directory structure of your original repo (which I think is better)

with-expecter: True
dir: mocks/{{ replaceAll .InterfaceDirRelative "internal" "internal_" }} 
mockname: "{{.InterfaceName}}"
outpkg: "{{.PackageName}}"
filename: "{{.InterfaceName}}.go"
all: True
packages:
  github.com/runatlantis/atlantis:
    config:
      recursive: True

Or you could have the mocks adjacent to the interface if you wanted:
https://vektra.github.io/mockery/latest/migrating_to_packages/#adjacent-to-interface

@chenrui333
Copy link
Member Author

@james0209 thanks for weighing in here, yeah, I was definitely thinking that I was going with the packages configuration route. :) Any way, let me refine the PR a bit.

@GenPage GenPage added help wanted Good feature for contributors refactoring Code refactoring that doesn't add additional functionality labels Jul 1, 2024
@chenrui333
Copy link
Member Author

todos for this pr:

  • update the mocks to looks similar as pegomock
  • import mockery and rerun tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Good feature for contributors refactoring Code refactoring that doesn't add additional functionality size/xl
Projects
None yet
Development

Successfully merging this pull request may close these issues.

go-generate step is broken
3 participants