Include event messages in aggregated events

This changes the event aggregation behavior so that, when multiple events are
deduplicated, the aggregated event includes the message of the latest related
event.

This fixes an issue where the original event expires due to TTL, and the
aggregate event doesn't contain any useful message.

Kubernetes-commit: 6ada269d8f199b02dd5852f1545746a14f58f4eb
This commit is contained in:
Ken Simon
2017-05-17 10:34:40 -07:00
committed by Kubernetes Publisher
parent 2e44fe3560
commit 6bfadd9f8f
2 changed files with 38 additions and 21 deletions

View File

@@ -157,10 +157,11 @@ func TestEventAggregatorByReasonFunc(t *testing.T) {
// TestEventAggregatorByReasonMessageFunc validates the proper output for an aggregate message
func TestEventAggregatorByReasonMessageFunc(t *testing.T) {
expected := "(events with common reason combined)"
expectedPrefix := "(combined from similar events): "
event1 := makeEvent("end-of-world", "it was fun", makeObjectReference("Pod", "pod1", "other"))
if actual := EventAggregatorByReasonMessageFunc(&event1); expected != actual {
t.Errorf("Expected %v got %v", expected, actual)
actual := EventAggregatorByReasonMessageFunc(&event1)
if !strings.HasPrefix(actual, expectedPrefix) {
t.Errorf("Expected %v to begin with prefix %v", actual, expectedPrefix)
}
}