Skip to content

Conversation

@mmorel-35
Copy link
Contributor

@mmorel-35 mmorel-35 commented Oct 12, 2025

Description

Mock Constructors from mockery allows to replace factory := &mocks.Factory{} with mocks.NewFactory(t)

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Title of the PR
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@bunnyshell
Copy link

bunnyshell bot commented Oct 12, 2025

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

@mmorel-35 mmorel-35 force-pushed the expecterlint branch 4 times, most recently from 3f804ae to 777b5a9 Compare October 12, 2025 10:03
@codecov
Copy link

codecov bot commented Oct 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.79%. Comparing base (95b191d) to head (fafd0e7).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #24940      +/-   ##
==========================================
- Coverage   60.79%   60.79%   -0.01%     
==========================================
  Files         351      351              
  Lines       60439    60439              
==========================================
- Hits        36745    36744       -1     
  Misses      20772    20772              
- Partials     2922     2923       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mmorel-35 mmorel-35 force-pushed the expecterlint branch 3 times, most recently from 6f78959 to fafd0e7 Compare October 12, 2025 15:37
@mmorel-35 mmorel-35 marked this pull request as ready for review October 12, 2025 15:45
@mmorel-35 mmorel-35 requested review from a team as code owners October 12, 2025 15:45
@mmorel-35 mmorel-35 force-pushed the expecterlint branch 7 times, most recently from 6940093 to a984284 Compare October 13, 2025 05:48
@mmorel-35 mmorel-35 marked this pull request as draft October 13, 2025 05:48
@mmorel-35 mmorel-35 force-pushed the expecterlint branch 4 times, most recently from f7ad349 to 9897e99 Compare October 13, 2025 17:27
@mmorel-35
Copy link
Contributor Author

@crenshaw-dev ,

The TestAppRevisionsMultiSource is failing. Does the order matter here ? Any suggestion on the way to adress this ?

@mmorel-35 mmorel-35 marked this pull request as ready for review October 14, 2025 06:03
@mmorel-35 mmorel-35 force-pushed the expecterlint branch 4 times, most recently from 4c8190e to 6d42cdd Compare October 17, 2025 09:32
@mmorel-35 mmorel-35 force-pushed the expecterlint branch 3 times, most recently from abcf7ab to eeefdc5 Compare October 17, 2025 10:10
)
db := &dbmocks.ArgoDB{}
db.On("GetApplicationControllerReplicas").Return(1)
db := dbmocks.NewArgoDB(t)
Copy link
Member

@blakepettersson blakepettersson Oct 27, 2025

Choose a reason for hiding this comment

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

For some reason this change is making the test fail.

Suggested change
db := dbmocks.NewArgoDB(t)
db := &dbmocks.ArgoDB{}

@mmorel-35 mmorel-35 force-pushed the expecterlint branch 10 times, most recently from 099686c to 20a6825 Compare October 31, 2025 12:43
@mmorel-35 mmorel-35 changed the title chore: use expecter struct from mockery chore: use Mock Constructors from mockery Oct 31, 2025
@mmorel-35 mmorel-35 force-pushed the expecterlint branch 5 times, most recently from e1d49f3 to 4fff3cb Compare October 31, 2025 17:32
@blakepettersson
Copy link
Member

@mmorel-35 my 2 cents on having mock constructors checking and expecting all the calls is that this will be quite obnoxious - most of the time when we write tests we want stubs (basically "if this method is called return this value" and nothing else), and we do this in bulk in some places, because we just want some arbitrary values for being able to run the tests.

My general feeling is that we'll now be adding a bunch of actual mocks (every expectation that gets setup will get verified by mockery), and that this change will be a bit too intrusive for the dev/test workflow.

@mmorel-35 mmorel-35 marked this pull request as draft October 31, 2025 18:02
@mmorel-35
Copy link
Contributor Author

Ok, let's drop this !

@mmorel-35 mmorel-35 closed this Oct 31, 2025
@blakepettersson
Copy link
Member

@mmorel-35 I think the expector struct thing is a good thing though, so if you could do that and stick with using &mocks.Factory{} for the time being I think that would be the way to go 🙏

@mmorel-35 mmorel-35 deleted the expecterlint branch November 1, 2025 03:24
@mmorel-35
Copy link
Contributor Author

I'll try again on this part

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