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

Fixes #769 : Mock files getting created in disk when dry-run is enabled #789

Merged
merged 4 commits into from
Jun 24, 2024

Conversation

snopan
Copy link
Contributor

@snopan snopan commented Jun 23, 2024

Description

The PR aims to fix an issue with dry-run option when enabled is still creating the mock files in disk. There's an existing PR to resolve this but I can see it's been inactive since April so I thought to start another PR to resolve the comment. If this isn't okay please let me know, I'm still new to contributing to open source.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Version of Golang used when building/testing:

  • 1.11
  • 1.12
  • 1.13
  • 1.14
  • 1.15
  • 1.16
  • 1.17
  • 1.18
  • 1.19
  • 1.20
  • 1.22

How Has This Been Tested?

  1. Cleared the mocks by running task mocks.remove
  2. Added dry-run: True to mockery.yaml
  3. Ran task mocks which should only log and not create the files

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@snopan
Copy link
Contributor Author

snopan commented Jun 23, 2024

Hey @LandonTClipp, I saw the issue was inactive and I thought to give it a try hope it is okay. Feel free to have a review when you're free, thanks.

Copy link
Collaborator

@LandonTClipp LandonTClipp left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for the fix.

@LandonTClipp
Copy link
Collaborator

LandonTClipp commented Jun 24, 2024

Looks like something is wrong, maybe dry-run is getting enabled in the tests when we didn't expect? I'll let you dig into it.

@snopan
Copy link
Contributor Author

snopan commented Jun 24, 2024

Yup so the original unit test had dryRun set to true while checking that files are created. Instead I've updated the tests to check dryRun as both true and false to confirm that files creation depend on that. I've also removed the wantError field from the test case as it's not used, is this common that fields are added but not used? If we need that there then I can add it back.

@LandonTClipp if I can get another review that would be great, thanks!

Copy link
Collaborator

@LandonTClipp LandonTClipp left a comment

Choose a reason for hiding this comment

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

Wonderful, thank you!

@LandonTClipp LandonTClipp merged commit 0650c45 into vektra:master Jun 24, 2024
4 checks passed
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.

Files being created even with dry-run: true
2 participants