func generateEvents(n int, triggerID string) chan *notifier.EventData {
	ch := make(chan *notifier.EventData)
	go func() {
		for i := 0; i < n; i++ {
			event := &notifier.EventData{
				Timestamp: notifier.GetNow().Unix(),
				Metric:    fmt.Sprintf("Metric number #%d", i),
				TriggerID: triggerID,
			}
			ch <- event
		}
		close(ch)
	}()
	return ch
}
	var err error
	var event notifier.EventData

	BeforeSuite(func() {
		log, _ = logging.GetLogger("notifier")
		notifier.SetLogger(log)
		testConfig.dict["notifier"] = make(map[string]string)
		testConfig.dict["notifier"]["sender_timeout"] = "0s10ms"
		testConfig.dict["notifier"]["resending_timeout"] = "24:00"
		notifier.SetSettings(testConfig)
		logging.SetFormatter(logging.MustStringFormatter("%{time:2006-01-02 15:04:05}\t%{level}\t%{message}"))
		logBackend := logging.NewLogBackend(os.Stdout, "", 0)
		logBackend.Color = false
		logging.SetBackend(logBackend)
		logging.SetLevel(logging.DEBUG, "notifier")
		now := notifier.GetNow()
		log.Debug("Using now time: %s, %s", now, now.Weekday())
	})

	AfterEach(func() {
		stopSenders()
	})

	BeforeEach(func() {
		testDb = &testDatabase{&notifier.DbConnector{}}
		if *useFakeDb {
			c := redigomock.NewFakeRedis()
			testDb.conn.Pool = &redis.Pool{
				MaxIdle:     3,
				IdleTimeout: 240 * time.Second,
				Dial: func() (redis.Conn, error) {