Skip to content

Conversation

AnmolxSingh
Copy link
Contributor

@AnmolxSingh AnmolxSingh commented Apr 17, 2025

Which problem is this PR solving?

Description of the changes

How was this change tested?

  • ran lint tests

Checklist

Signed-off-by: anmol7344 <anmol7344@gmail.com>
@AnmolxSingh AnmolxSingh requested a review from a team as a code owner April 17, 2025 20:30
@AnmolxSingh AnmolxSingh requested a review from pavolloffay April 17, 2025 20:30
@dosubot dosubot bot added the go Pull requests that update go code label Apr 17, 2025
Copy link

codecov bot commented Apr 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.75%. Comparing base (40e1ff3) to head (0187c02).
Report is 6 commits behind head on main.

❌ Your project status has failed because the head coverage (50.75%) is below the target coverage (95.00%). You can increase the head coverage or adjust the target coverage.

❗ There is a different number of reports uploaded between BASE (40e1ff3) and HEAD (0187c02). Click for more details.

HEAD has 23 uploads less than BASE
Flag BASE (40e1ff3) HEAD (0187c02)
badger_v1 2 1
grpc_v1 2 1
kafka-3.x-v1 2 1
badger_v2 2 1
memory_v2 2 1
grpc_v2 2 1
tailsampling-processor 2 1
elasticsearch-6.x-v1 2 1
kafka-3.x-v2 2 1
opensearch-1.x-v1 2 1
cassandra-4.x-v1-manual 2 1
cassandra-5.x-v1-manual 2 1
elasticsearch-8.x-v1 2 1
elasticsearch-7.x-v1 2 1
opensearch-2.x-v1 2 1
unittests 2 0
opensearch-2.x-v2 2 1
elasticsearch-8.x-v2 2 1
cassandra-5.x-v2-auto 2 1
cassandra-4.x-v2-manual 2 1
cassandra-4.x-v2-auto 2 1
cassandra-5.x-v2-manual 2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #7042       +/-   ##
===========================================
- Coverage   96.01%   50.75%   -45.27%     
===========================================
  Files         349      176      -173     
  Lines       20677    10701     -9976     
===========================================
- Hits        19854     5431    -14423     
- Misses        620     4868     +4248     
- Partials      203      402      +199     
Flag Coverage Δ
badger_v1 9.98% <ø> (ø)
badger_v2 2.07% <ø> (ø)
cassandra-4.x-v1-manual 15.02% <ø> (ø)
cassandra-4.x-v2-auto 2.06% <ø> (ø)
cassandra-4.x-v2-manual 2.06% <ø> (ø)
cassandra-5.x-v1-manual 15.02% <ø> (ø)
cassandra-5.x-v2-auto 2.06% <ø> (ø)
cassandra-5.x-v2-manual 2.06% <ø> (ø)
elasticsearch-6.x-v1 19.88% <ø> (ø)
elasticsearch-7.x-v1 19.96% <ø> (ø)
elasticsearch-8.x-v1 20.13% <ø> (ø)
elasticsearch-8.x-v2 2.07% <ø> (ø)
grpc_v1 11.53% <ø> (ø)
grpc_v2 9.16% <ø> (ø)
kafka-3.x-v1 10.26% <ø> (ø)
kafka-3.x-v2 2.07% <ø> (ø)
memory_v2 2.07% <ø> (ø)
opensearch-1.x-v1 20.01% <ø> (ø)
opensearch-2.x-v1 20.01% <ø> (ø)
opensearch-2.x-v2 2.07% <ø> (ø)
tailsampling-processor 0.56% <ø> (ø)
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AnmolxSingh
Copy link
Contributor Author

@yurishkuro what failed in Lint Checks i did not quite get them.

@yurishkuro
Copy link
Member

it seems lots of test files are being generated for mocks now

?? cmd/collector/app/sanitizer/cache/mocks/mocks_test.go
?? cmd/ingester/app/consumer/mocks/mocks_test.go
?? cmd/ingester/app/processor/mocks/mocks_test.go

I am not sure what value these tests provide, as we don't test codegen files and exclude them from code coverage calculations. Can we tell mockery not to generate the test files?

@AnmolxSingh
Copy link
Contributor Author

it seems lots of test files are being generated for mocks now

?? cmd/collector/app/sanitizer/cache/mocks/mocks_test.go
?? cmd/ingester/app/consumer/mocks/mocks_test.go
?? cmd/ingester/app/processor/mocks/mocks_test.go

I am not sure what value these tests provide, as we don't test codegen files and exclude them from code coverage calculations. Can we tell mockery not to generate the test files?

I did not get any config option to disable the test files generation.

@yurishkuro
Copy link
Member

Turns out these are not test files, it's where mockery now generates the mocks. So your change builds fine in the CI because you did not delete any of the old files (which are used to compile code) and did not check-in the new files (which would not compile because they are used from other packages, and I don't think _test.go code is exposed outside of a package).

@AnmolxSingh
Copy link
Contributor Author

Turns out these are not test files, it's where mockery now generates the mocks. So your change builds fine in the CI because you did not delete any of the old files (which are used to compile code) and did not check-in the new files (which would not compile because they are used from other packages, and I don't think _test.go code is exposed outside of a package).

So old files are to be replaced with new mock files?

@yurishkuro
Copy link
Member

yurishkuro commented Apr 17, 2025

If there's no way to keep the old style files then you need to delete them and commit the new ones. I think it would also be good to do the deletion automatically by looping through all dirs in mockery config and running rm $dir/*.go before regenerating. This will ensure we don't have stale files.

@AnmolxSingh
Copy link
Contributor Author

AnmolxSingh commented Apr 18, 2025

I have removed all the old files but the issue is mocks_test.go being the only file in mocks folder golang ignores that module and does not import it so should i rename it to mocks.go

@yurishkuro
Copy link
Member

Change the file name to mocks.go, there is a config option guy for that.

@AnmolxSingh
Copy link
Contributor Author

Some of the generated mocks are failing unit tests. It is hard to pinpoint the reason. It seems there might be mismatch between mocks and actual function but i am not sure how to fix this.

@yurishkuro
Copy link
Member

I don't see any failures of tests in the CI

Signed-off-by: anmol7344 <anmol7344@gmail.com>
@AnmolxSingh
Copy link
Contributor Author

actually i tested them locally. Now i have pushed them to the pr

@yurishkuro
Copy link
Member

Something might have changed in mockery to make it more strict. We need to take this package by package. It's all fixable. Looking at some of the errors it seems obvious which arguments are missing to the mock calls.

@yurishkuro
Copy link
Member

See #7045 #7046

@AnmolxSingh
Copy link
Contributor Author

I think #7045 generates mocks in v2. .mockery.yaml had to be changed to v3 before generating mocks

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

@yurishkuro
Copy link
Member

yurishkuro commented Apr 18, 2025

The issues you encounter are happening with mockery v2, so we need to fix them there first, to make the migration smoother. I think #7046 narrows down the issue to just Cassandra mocks

@AnmolxSingh
Copy link
Contributor Author

I think i encountered issues after migrating to v3. All the previous mocks are changed with new mocks.

@AnmolxSingh
Copy link
Contributor Author

I think if migrating to v3 was not the point then it defies the the purpose of the issue.

@yurishkuro
Copy link
Member

I think i encountered issues after migrating to v3.

Yes because the defaults were changed in v3 and we were already getting a warning about that in v2. So the better approach is to fix the warnings in v2 first before upgrading.

@AnmolxSingh
Copy link
Contributor Author

Oh! actually almost fixed all the warnings in v3 so now should I switch back to v2 fix the warnings by opening a new pr?

@yurishkuro
Copy link
Member

I removed the last instance of that flag (warning) #7048 (feel free to approve)

@yurishkuro
Copy link
Member

And you may have to recreate this PR after #7048 is merged, otherwise you will have lots of conflicts.

@AnmolxSingh
Copy link
Contributor Author

Closing this pr as it is already having lot of merge conflicts. Will open a new pr when #7048 is merged.

@AnmolxSingh AnmolxSingh deleted the mockery branch April 19, 2025 14:27
github-merge-queue bot pushed a commit that referenced this pull request Apr 20, 2025
## Which problem is this PR solving?
- Resolves #7008 

## Description of the changes
- Continuation of pr #7042 

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `npm run lint` and `npm run test`

---------

Signed-off-by: anmol7344 <anmol7344@gmail.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Co-authored-by: Yuri Shkuro <github@ysh.us>
amilbcahat pushed a commit to amilbcahat/jaeger that referenced this pull request May 4, 2025
## Which problem is this PR solving?
- Resolves jaegertracing#7008 

## Description of the changes
- Continuation of pr jaegertracing#7042 

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `npm run lint` and `npm run test`

---------

Signed-off-by: anmol7344 <anmol7344@gmail.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Co-authored-by: Yuri Shkuro <github@ysh.us>
amilbcahat pushed a commit to amilbcahat/jaeger that referenced this pull request May 4, 2025
## Which problem is this PR solving?
- Resolves jaegertracing#7008

## Description of the changes
- Continuation of pr jaegertracing#7042

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `npm run lint` and `npm run test`

---------

Signed-off-by: anmol7344 <anmol7344@gmail.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Co-authored-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: amol-verma-allen <amol.verma@allen.in>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade mockery to v3
2 participants