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

PORT-8146 filter events without diff in port #66

Merged
merged 8 commits into from
May 20, 2024

Conversation

razsamuel
Copy link
Contributor

…uests using hash

Description

What -
Why -
How -

Type of change

Please leave one option from the following and delete the rest:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Non-breaking change (fix of existing functionality that will not change current behavior)
  • Documentation (added/updated documentation)


if updateEntityOnlyOnDiff == false {
return true
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

else is redundant

@@ -317,3 +347,76 @@ func TestGetEntitiesSet(t *testing.T) {
f := newFixture(t, "", "", "", resource, objects)
f.runControllerGetEntitiesSet(expectedEntitiesSet, false)
}

func TestUpdateDeploymentWithoutDiff(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should remove

assert.True(t, result, "Expected true when different object and feature flag is off")

controllerWithPartialMapping := newFixture(t, "", "", "", partialMappingWithoutLables, []runtime.Object{}).controller
result = controllerWithPartialMapping.shouldSendUpdateEvent(oldDeployment, newDep, true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add with feature flag false

klog.Errorf("Error getting new entities: %v", err)
return true
}
oldEntitiesHash, err := hashAllEntities(oldEntities)
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding tests to hash various entities

return true
}

if oldEntitiesHash != newEntitiesHash {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do the opposite - return false if they equal, and return true below

@razsamuel razsamuel merged commit b5002ea into main May 20, 2024
1 check passed
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