Beispiel #1
0
func readSettings(configFileName string) error {
	file, err := yaml.Open(configFileName)
	if err != nil {
		return fmt.Errorf("Can't read config file %s: %s", configFileName, err.Error())
	}
	config = &yamlSettings{file}
	notifier.SetSettings(config)

	return nil
}
	} else {
		RunSpecs(t, "Notifier Suite")
	}
}

var _ = Describe("Notifier", func() {
	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{}}