mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 20:20:25 +03:00
Add tests for minio top level
This commit is contained in:
+26
-2
@@ -16,8 +16,32 @@
|
||||
|
||||
package main
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
func (s *CmdTestSuite) TestLogger(c *C) {
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/minio/minio/pkg/probe"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
func (s *TestSuite) TestLogger(c *C) {
|
||||
var buffer bytes.Buffer
|
||||
var fields logrus.Fields
|
||||
log.Out = &buffer
|
||||
log.Formatter = new(logrus.JSONFormatter)
|
||||
|
||||
errorIf(probe.NewError(errors.New("Fake error")), "Failed with error.", nil)
|
||||
err := json.Unmarshal(buffer.Bytes(), &fields)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(fields["level"], Equals, "error")
|
||||
|
||||
msg, ok := fields["error"]
|
||||
c.Assert(ok, Equals, true)
|
||||
c.Assert(msg, Equals, "Fake error")
|
||||
|
||||
_, ok = fields["probe"]
|
||||
c.Assert(ok, Equals, true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user