Skip to content

Conversation

@manusa
Copy link
Member

@manusa manusa commented Dec 1, 2025

Relates to #522

@manusa manusa added this to the 0.1.0 milestone Dec 1, 2025
@Cali0707 Cali0707 requested a review from nader-ziada December 1, 2025 15:12
close(callbackInvoked)
})
return nil
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is no guarantee here that the watcher has successfully started listening for events. I feel like this might introduce a race?

Copy link
Member Author

@manusa manusa Dec 2, 2025

Choose a reason for hiding this comment

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

This is a utility callback for the tests (not production code).

It's used to wait for the callback to be invoked and then proceed with the assertions.
If the watchers haven't started (or any other issue) the callback will never be invoked and the tests will fail after the provided timeout.

I haven't seen any concurrency issues so far.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, thinking it better, I understand that maybe you're referring that the fn() is invoked without guarantees of watchers having started.

For the watcher.Kubeconfig the code is synchronous and shouldn't be an issue, the watch is started by the time the method returns.

For watcher.ClusterState the code is not synchronous, but shouldn't be an issue either.

In all cases, the code executed in the enclosed fn() is what unblocks the callbackInvoked select.
If there's a race condition the test simply won't pass.

@manusa
Copy link
Member Author

manusa commented Dec 2, 2025

Closing in favor of #532 which addresses the issue too.

@manusa manusa closed this Dec 2, 2025
@manusa manusa deleted the test/provider-watch branch December 2, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants