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(test): adds clearUnusedMocks flag to remove the unused mocks of a test-set #1713

Merged
merged 9 commits into from
Mar 19, 2024

Conversation

re-Tick
Copy link
Contributor

@re-Tick re-Tick commented Mar 19, 2024

Related Issue

  • When the test-case is deleted from the test-set, the mocks for that test-case still exists in the mocks.yaml file of that test-set. The mocks should be cleared on running test cmd.

Closes: #1712

Describe the changes you've made

The changes do 2 things:

  • Logs the used mocks by the failed test-case in its result log
  • Adds a --clearUnusedMocks flag for test cmd to remove the unused mocks from the mocks.yaml of the test-set.

Type of change

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

Please let us know if any test cases are added

Tested the changes with go sample application for gin-mongo, mux-sql.

Describe if there is any unusual behaviour of your code(Write NA if there isn't)

A clear and concise description of it.

Checklist:

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own 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.

pkg/platform/yaml/mockdb/db.go Dismissed Show dismissed Hide dismissed
Signed-off-by: re-Tick <jain.ritik.1001@gmail.com>
Signed-off-by: re-Tick <jain.ritik.1001@gmail.com>
Signed-off-by: re-Tick <jain.ritik.1001@gmail.com>
Signed-off-by: re-Tick <jain.ritik.1001@gmail.com>
Signed-off-by: re-Tick <jain.ritik.1001@gmail.com>
Copy link
Member

@charankamarapu charankamarapu left a comment

Choose a reason for hiding this comment

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

Please address the comments

cli/provider/cmd.go Outdated Show resolved Hide resolved
cli/provider/cmd.go Outdated Show resolved Hide resolved
pkg/core/proxy/mockmanager.go Outdated Show resolved Hide resolved
pkg/core/proxy/mockmanager.go Show resolved Hide resolved
pkg/service/replay/replay.go Outdated Show resolved Hide resolved
pkg/service/replay/replay.go Show resolved Hide resolved
re-Tick and others added 2 commits March 19, 2024 18:25
@re-Tick
Copy link
Contributor Author

re-Tick commented Mar 19, 2024

Please review now, addressed your comments.

@charankamarapu charankamarapu self-requested a review March 19, 2024 13:23
Copy link
Member

@charankamarapu charankamarapu left a comment

Choose a reason for hiding this comment

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

Ship it!

@re-Tick re-Tick merged commit 895f699 into main Mar 19, 2024
9 of 14 checks passed
@re-Tick re-Tick deleted the log-used-mocks branch March 19, 2024 17:09
@github-actions github-actions bot locked and limited conversation to collaborators Mar 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature]: Mocks should be deleted for the deleted test-case of test-set
3 participants