Skip to content

Commit

Permalink
updated unit tests to include notifications in common package
Browse files Browse the repository at this point in the history
  • Loading branch information
Devaansh-Kumar committed Nov 22, 2024
1 parent 2cb7d04 commit 9988220
Show file tree
Hide file tree
Showing 2 changed files with 277 additions and 134 deletions.
7 changes: 6 additions & 1 deletion pkg/i2gw/notifications/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

func init() {
NotificationAggr = NotificationAggregator{Notifications: map[string][]Notification{}}
NotificationAggr = BuildNotificationAggregator()
}

const (
Expand Down Expand Up @@ -55,6 +55,11 @@ var NotificationAggr NotificationAggregator
// package without the common package having knowledge about which provider is making a call it
type NotificationCallback func(mType MessageType, message string, CallingObjects ...client.Object)

// BuildNotificationAggregator returns an instance of initialized NotificationAggregator
func BuildNotificationAggregator() NotificationAggregator {
return NotificationAggregator{Notifications: map[string][]Notification{}}
}

// DispatchNotification is used to send a notification to the NotificationAggregator
func (na *NotificationAggregator) DispatchNotification(notification Notification, ProviderName string) {
na.mutex.Lock()
Expand Down
Loading

0 comments on commit 9988220

Please sign in to comment.