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

[es cit] Use storage factory instead of manual creation #5313

Merged
merged 28 commits into from
Apr 6, 2024

Conversation

Wise-Wizard
Copy link
Contributor

@Wise-Wizard Wise-Wizard commented Mar 30, 2024

Which problem is this PR solving?

This PR addresses a new found issue which is a part of the issue #5203 .
It initializes ES Factory in the Integration Test Suite.

Description:
This PR introduces changes to the integration tests by initializing an ElasticSearch factory (es.Factory) and utilizing it for the creation of span readers and writers. Previously, the code instantiated a new span reader/writer from the SpanStore directly, which has been replaced with the more appropriate approach of leveraging the ElasticSearch factory.

How was this change tested?

The changes were tested by running the following command:

make test

Checklist

  • I have read CONTRIBUTING_GUIDELINES.md
  • I have signed all commits
  • I have added unit tests for the new functionality
  • I have run lint and test steps successfully
    • for jaeger: make lint test
    • for jaeger-ui: yarn lint and yarn test

Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
@Wise-Wizard Wise-Wizard requested a review from a team as a code owner March 30, 2024 12:52
@Wise-Wizard
Copy link
Contributor Author

Hi @yurishkuro, Can you please guide me on how to test these Github Workflows locally? I have to push everytime I make changes to see if it is right or not.

Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
@yurishkuro
Copy link
Member

You can check the code for the workflows in .github dir. usually we keep them very simple, all of the test business logic is in the script that the workflow runs, precisely to allow local debugging. You can run the script manually.

@yurishkuro yurishkuro added the changelog:test Change that's adding missing tests or correcting existing tests label Mar 30, 2024
@Wise-Wizard
Copy link
Contributor Author

You can check the code for the workflows in .github dir. usually we keep them very simple, all of the test business logic is in the script that the workflow runs, precisely to allow local debugging. You can run the script manually.

Understood Thanks!
Since, I am using WSL I will have to install "act" and run a specific job using act -j right? Or, is there a simpler way?

@yurishkuro
Copy link
Member

don't know what act is - you should only need Docker

@Wise-Wizard
Copy link
Contributor Author

don't know what act is - you should only need Docker

While googling how to run github actions locally, almost 10-12 sites used a github repo nektos/act to run the actions locally. I already am using docker, will look into it further. Thanks for your guidance.

@yurishkuro
Copy link
Member

you don not need to run actions locally. Actions just call a shell script, you can run the shell script locally. This is the only line relevant to running ES test locally:

run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.image }}

@yurishkuro
Copy link
Member

please rebase, there were changes in the signatures

@Wise-Wizard
Copy link
Contributor Author

you don not need to run actions locally. Actions just call a shell script, you can run the shell script locally. This is the only line relevant to running ES test locally:

run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.image }}

Got it, Thanks a lot!

@Wise-Wizard
Copy link
Contributor Author

Wise-Wizard commented Mar 31, 2024

if !f.archiveConfig.Enabled {
return nil, nil
}
Because of this flag, the ArchiveSpanReader is being initialized as nil.
Can you please guide me on how to Enable this value as true while initializing ES factory? I have InitFromViper but it is still not enabled

Wise-Wizard and others added 3 commits April 1, 2024 09:23
Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

you need to rebase from main, your branch is stale

plugin/storage/integration/elasticsearch_test.go Outdated Show resolved Hide resolved
Wise-Wizard and others added 6 commits April 2, 2024 09:46
Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
Wise-Wizard and others added 4 commits April 4, 2024 17:16
Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
@Wise-Wizard
Copy link
Contributor Author

Wise-Wizard commented Apr 4, 2024

Hi, Took some time to debug the issue, but according to me the client being intialized is the reason. The client used in Factory initialization differs from the actual initialization of client, specific to the tests which is causing the Errors.
PTAL, would really appreciate your insights.

@yurishkuro
Copy link
Member

could you please document what debugging you did and what you found? Were you able to log the queries?

@Wise-Wizard
Copy link
Contributor Author

could you please document what debugging you did and what you found? Were you able to log the queries?

Yes, I was able to log the queries using SetTraceLog, but the logs didn't show anything evident enough for debugging.
So, instead I ran a debugger in the Main code and my Branch code.
The debugger showed the only difference in the initialisation of SpanReader...
The difference was the client passed to SpanReader which was causing the Error

@yurishkuro
Copy link
Member

so what's the state now, were you able to resolve the issue? I see the CI is still failing.

@Wise-Wizard
Copy link
Contributor Author

Wise-Wizard commented Apr 5, 2024

so what's the state now, were you able to resolve the issue? I see the CI is still failing.

Yes, the GetOperation and the first 2 tests were successful, but I had to do something unorthodox i.e to change the Factory file of ES and do things differently. Can you please look at it and see if it's acceptable?
Update: All the tests are successful now!

Wise-Wizard and others added 2 commits April 5, 2024 12:24
Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
Copy link

codecov bot commented Apr 5, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 95.25%. Comparing base (7fcbca8) to head (2863e8d).

Files Patch % Lines
plugin/storage/integration/integration.go 75.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5313      +/-   ##
==========================================
+ Coverage   95.16%   95.25%   +0.09%     
==========================================
  Files         340      340              
  Lines       16666    16672       +6     
==========================================
+ Hits        15860    15881      +21     
+ Misses        616      602      -14     
+ Partials      190      189       -1     
Flag Coverage Δ
badger 11.18% <0.00%> (-1.08%) ⬇️
cassandra-3.x 19.33% <75.00%> (-1.81%) ⬇️
cassandra-4.x 19.33% <75.00%> (-1.81%) ⬇️
elasticsearch-5.x 22.20% <75.00%> (+4.50%) ⬆️
elasticsearch-6.x 22.20% <75.00%> (+4.50%) ⬆️
elasticsearch-7.x 22.25% <75.00%> (+4.50%) ⬆️
elasticsearch-8.x 22.46% <75.00%> (+4.62%) ⬆️
grpc 11.57% <0.00%> (+0.01%) ⬆️
kafka 10.81% <0.00%> (-1.04%) ⬇️
opensearch-1.x 22.31% <75.00%> (+4.54%) ⬆️
opensearch-2.x 22.31% <75.00%> (+4.56%) ⬆️
unittests 92.31% <0.00%> (-0.03%) ⬇️

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.

Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
Signed-off-by: Wise-Wizard <saransh.shankar@gmail.com>
@yurishkuro
Copy link
Member

Please remove commented out code

@Wise-Wizard
Copy link
Contributor Author

Please remove commented out code

Done, PTAL!

Signed-off-by: Yuri Shkuro <github@ysh.us>
@yurishkuro
Copy link
Member

I removed custom initialization in favor of CLI-based factory creation. There is room for more similar clean-up for sampling store, but it also has a bug that needs to be fixed #5333

@yurishkuro yurishkuro changed the title Intialized ES factory [es cit] Use storage factory instead of manual creation Apr 6, 2024
@yurishkuro yurishkuro merged commit 88af82e into jaegertracing:main Apr 6, 2024
36 of 37 checks passed
@Wise-Wizard
Copy link
Contributor Author

I removed custom initialization in favor of CLI-based factory creation. There is room for more similar clean-up for sampling store, but it also has a bug that needs to be fixed #5333

Sure!
Should I look into that next?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:test Change that's adding missing tests or correcting existing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants