-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
…RT-8146-filter-events-without-diff
pkg/k8s/controller.go
Outdated
|
||
if updateEntityOnlyOnDiff == false { | ||
return true | ||
} else { |
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.
else is redundant
pkg/k8s/controller_test.go
Outdated
@@ -317,3 +347,76 @@ func TestGetEntitiesSet(t *testing.T) { | |||
f := newFixture(t, "", "", "", resource, objects) | |||
f.runControllerGetEntitiesSet(expectedEntitiesSet, false) | |||
} | |||
|
|||
func TestUpdateDeploymentWithoutDiff(t *testing.T) { |
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.
Should remove
pkg/k8s/controller_test.go
Outdated
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) |
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.
Add with feature flag false
pkg/k8s/controller.go
Outdated
klog.Errorf("Error getting new entities: %v", err) | ||
return true | ||
} | ||
oldEntitiesHash, err := hashAllEntities(oldEntities) |
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.
Consider adding tests to hash various entities
pkg/k8s/controller.go
Outdated
return true | ||
} | ||
|
||
if oldEntitiesHash != newEntitiesHash { |
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.
Do the opposite - return false if they equal, and return true below
…uests using hash
Description
What -
Why -
How -
Type of change
Please leave one option from the following and delete the rest: