-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[chore][extension/observer/k8sobserver] try to fix flaky test (DATA RACE) of TestExtensionObservePods #29463
[chore][extension/observer/k8sobserver] try to fix flaky test (DATA RACE) of TestExtensionObservePods #29463
Conversation
I'm a bit worried about removing the proxy setting when it's set to |
Thanks for your reviews @crobert-1! I shouldn't remove this proxy setting, i need to further investigate the specific reason before taking any action. |
…ACE) of TestExtensionObservePods Signed-off-by: sakulali <sakulali@126.com>
…same process using podListerWatcher Signed-off-by: sakulali <sakulali@126.com>
48f1e37
to
9768453
Compare
Hi @crobert-1, could you mind help to reviews again? After I added debug logs, i discovered some interesting things and maybe we can resolve this issue, please refer to the above |
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.
Looks good to me, thanks for including all of the references as well!
Description:
Try to fix flaky test (DATA RACE) of
TestExtensionObservePods
. Sinceconfig.ObservePods
is set true by default, forTestExtensionObserveServices
andTestExtensionObserveNodes
test case, we just focus on services observer and nodes observer, so we don't need to usek8sObserver.podListerWatcher
which can avoid data race in the same process.Link to tracking Issue:
#29448
Testing:
go test for k8sobserver
Preparation:
Tests:
I found
config.ObservePods
is set true by default. ThenTestExtensionObserveServices
andTestExtensionObserveNodes
will enablek8sObserver.podListerWatcher
and try to access the same http proxy since they are in the same process.opentelemetry-collector-contrib/extension/observer/k8sobserver/factory.go
Lines 26 to 33 in 39641df
I add log(as shown below) for
TestExtensionObserve*
functions and found test case in the same process. Refer to stack overflow, go test are executed as goroutines and executed concurrently.Inference:
I found that
config.ObservePods
is set true by default. ForTestExtensionObserveServices
andTestExtensionObserveNodes
test case, we just focus on services observer and nodes observer, so we don't need to usek8sObserver.podListerWatcher
which can avoid data race in the same process.Documentation: