-
-
Notifications
You must be signed in to change notification settings - Fork 382
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: log all matched mocks per failed testcase #1573
feat: log all matched mocks per failed testcase #1573
Conversation
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
There was a problem hiding this 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 and fill the PR description
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Did you check if any new race condition is introduced ? |
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
0633d08
to
1de76f0
Compare
regarding the race condition, there were total 4 found data races, but none of them point to the files changed in this PR |
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
…tive mutex Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
9a12806
to
87ffb0c
Compare
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Related Issue
Closes: #1562
Describe the changes you've made
if debug flag is enabled then all the mocks which are matched are logged in case of failed testcase.
Added the logic to remove unused mocks when
removeUnusedMocks
flag is enabled.How I tested this feature ? (guide)
To test this feature I recorded two test-sets, one having 2 test-cases and other having 4 test-cases. ![image](https://github.com/keploy/keploy/assets/91385321/236c6632-effc-4b36-85d9-80181fa010e0)I added body.ts as a noisy field in test-set-1 which will let it to pass and test-set-0 will fail. purpose of doing this is to demonstrate that --removeUnusedMocks only works when test-set passes.
Now lets remove a test-case, say test-4.yaml.
currently, in mocks.yaml of test-set-1, there are a total of 7 mocks
lets run
keploy test
command with --removeUnusedMocks flag set and see the log:Looking at the logs you can notice that unused mocks are removed only after test-set-1, and not after failed test-set-0 as discussed above.
🐰 Keploy: 2024-02-22T15:30:53+05:30 INFO removed unused mocks from mock file {"test-set": "test-set-1"}
also now mocks.yaml has only 5 mocks instead of 6.
![image](https://private-user-images.githubusercontent.com/91385321/306953538-b62ef905-5093-4398-a1b1-9da27f8670cf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk4MjgyODEsIm5iZiI6MTcxOTgyNzk4MSwicGF0aCI6Ii85MTM4NTMyMS8zMDY5NTM1MzgtYjYyZWY5MDUtNTA5My00Mzk4LWExYjEtOWRhMjdmODY3MGNmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzAxVDA5NTk0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVjYTA4YzA2N2M5NmFhNTE5Nzk1ZTI5NGI4NWFjMTNjZGZjOWI4NjgyOTczNzc3YTc0MmMzMDFiZDFlMDg2NWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.HeHTM0OjARDOFCQ5ac02MjeF0yp_mxy8UJNpr_I1Ads)
Type of change
Please let us know if any test cases are added
Please describe the tests(if any). Provide instructions how its affecting the coverage.
Describe if there is any unusual behaviour of your code(Write
NA
if there isn't)A clear and concise description of it.
Checklist:
Screenshots (if any)