Skip to content

Commit d12893d

Browse files
committed
update unit tests
Signed-off-by: Kexin2000 <3299133282@qq.com>
1 parent 1e171c7 commit d12893d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/dependenciesdistributor/dependencies_distributor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ func (d *DependenciesDistributor) createOrUpdateAttachedBinding(attachedBinding
625625
existBinding.Spec.Resource = attachedBinding.Spec.Resource
626626
existBinding.Spec.PreserveResourcesOnDeletion = attachedBinding.Spec.PreserveResourcesOnDeletion
627627

628-
if conflictDetected {
628+
if conflictDetected && d.EventRecorder != nil {
629629
message := fmt.Sprintf("[dep-agg] conflict on %s/%s from parents %s: %s",
630630
existBinding.Namespace, existBinding.Name, strings.Join(parentsForEvent, ","), strings.Join(conflictDetails, "; "))
631631
d.EventRecorder.Eventf(existBinding, corev1.EventTypeWarning, events.EventReasonDependencyPolicyConflict, message)
@@ -636,7 +636,7 @@ func (d *DependenciesDistributor) createOrUpdateAttachedBinding(attachedBinding
636636
return err
637637
}
638638

639-
if shouldEmitAggregationEvent {
639+
if shouldEmitAggregationEvent && d.EventRecorder != nil {
640640
message := fmt.Sprintf("[dep-agg] aggregated policy for %s/%s from parents %s: conflictResolution=%s preserveResourcesOnDeletion=%t",
641641
existBinding.Namespace, existBinding.Name, strings.Join(parentsForEvent, ","), finalConflictResolution, finalPreserve)
642642
d.EventRecorder.Eventf(existBinding, corev1.EventTypeNormal, events.EventReasonDependencyPolicyAggregated, message)

0 commit comments

Comments
 (0)