2018-04-26 12:12:54 +02:00
|
|
|
package util
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestSendToSlack(t *testing.T) {
|
|
|
|
slackToken := os.Getenv("SLACK_TOKEN")
|
|
|
|
if slackToken == "" {
|
|
|
|
t.Error("A slack token was not provided")
|
|
|
|
}
|
2018-06-15 23:03:28 +02:00
|
|
|
host, err := os.Hostname()
|
|
|
|
if err != nil {
|
|
|
|
host = "ytsync-unknown"
|
|
|
|
}
|
|
|
|
InitSlack(os.Getenv("SLACK_TOKEN"), os.Getenv("SLACK_CHANNEL"), host)
|
|
|
|
SendInfoToSlack("This is a test :) Working %.2f%%", 1.01*100)
|
|
|
|
SendErrorToSlack("This is a test :) Working %.2f%%", 0.01*100)
|
2018-04-26 12:12:54 +02:00
|
|
|
}
|