Skip to content

fix: PerResourcePollingEventSource issue with resources #1417

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

Merged
merged 2 commits into from
Aug 24, 2022

Conversation

csviri
Copy link
Collaborator

@csviri csviri commented Aug 23, 2022

No description provided.

@csviri csviri linked an issue Aug 23, 2022 that may be closed by this pull request
@@ -134,8 +134,8 @@ public final synchronized void registerEventSource(String name, EventSource even
@SuppressWarnings("unchecked")
public void broadcastOnResourceEvent(ResourceAction action, R resource, R oldResource) {
eventSources.additionalNamedEventSources().forEach(eventSource -> {
if (eventSource instanceof ResourceEventAware) {
var lifecycleAwareES = ((ResourceEventAware<R>) eventSource);
if (eventSource.original() instanceof ResourceEventAware) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are there possibly other spots where a similar change would be needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well, good question, probably not, since it works. Just this did not have a integration test.

.build();

@Test
void managedDependentsAreReconciledInOrder() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This test name doesn't make sense…

Copy link
Collaborator Author

@csviri csviri Aug 24, 2022

Choose a reason for hiding this comment

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

changed.

EventSourceContext<PerResourceEventSourceCustomResource> context) {
this.eventSource =
new PerResourcePollingEventSource<>(primaryResource -> {
numberOfFetchExecutions.addAndGet(1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't the test make more sense if it checked that it's actually called once per primary resource? Right now, it only checks the fetcher is called, not that it's called per resource.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, true, will improve the test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

@csviri csviri requested a review from metacosm August 24, 2022 08:45
@csviri csviri force-pushed the perresource-it-and-fix branch from 0fed7d2 to 4c8a9b1 Compare August 24, 2022 09:07
@csviri csviri force-pushed the perresource-it-and-fix branch from 4c8a9b1 to e085ba3 Compare August 24, 2022 11:36
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

75.0% 75.0% Coverage
0.0% 0.0% Duplication

@csviri csviri self-assigned this Aug 24, 2022
@metacosm metacosm merged commit 7e9d4ef into main Aug 24, 2022
@metacosm metacosm deleted the perresource-it-and-fix branch August 24, 2022 14:11
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.

PerResourcePollingEventSource fetch called only once
2 participants