package webstocetmsg import ( "context" "testing" "time" "github.com/sirupsen/logrus" ) var ctx context.Context func init() { ctx = context.Background() } // TestPublish 测试发布消息到redis func TestPublish(t *testing.T) { msg := "当前时间: " + time.Now().Format("15:04:05") logrus.Debugf("[publish] msg: %s", msg) err := Publish(ctx, PublishKey, msg) if err != nil { logrus.Errorf("publish error: %s", err.Error()) } }