diff --git a/database/gredis/gredis_z_unit_test.go b/database/gredis/gredis_z_unit_test.go index dfc7a5570..bf24e991f 100644 --- a/database/gredis/gredis_z_unit_test.go +++ b/database/gredis/gredis_z_unit_test.go @@ -139,21 +139,11 @@ func Test_Instance(t *testing.T) { func Test_Error(t *testing.T) { gtest.C(t, func(t *gtest.T) { - //config1 := &gredis.Config{ - // Host: "127.0.0.2", - // Port: 6379, - // Db: 1, - // ConnectTimeout: time.Second, - //} - //redis := gredis.New(config1) - //_, err := redis.Do("info") - //t.AssertNE(err, nil) - config1 := &gredis.Config{ - Host: "127.0.0.1", - Port: 6379, - Db: 1, - Pass: "666666", + Host: "192.111.0.2", + Port: 6379, + Db: 1, + ConnectTimeout: time.Second, } redis := gredis.New(config1) _, err := redis.Do("info") diff --git a/os/glog/glog_z_unit_chaining_test.go b/os/glog/glog_z_unit_chaining_test.go index 407387e14..f6110e491 100644 --- a/os/glog/glog_z_unit_chaining_test.go +++ b/os/glog/glog_z_unit_chaining_test.go @@ -115,36 +115,38 @@ func Test_Stack(t *testing.T) { }) } -//func Test_StackWithFilter(t *testing.T) { -// gtest.C(t, func(t *gtest.T) { -// path := gfile.TempDir(gtime.TimestampNanoStr()) -// file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) -// -// err := gfile.Mkdir(path) -// t.Assert(err, nil) -// defer gfile.Remove(path) -// -// Path(path).File(file).StackWithFilter("none").Stdout(false).Error(1, 2, 3) -// content := gfile.GetContents(gfile.Join(path, file)) -// t.Assert(gstr.Count(content, defaultLevelPrefixes[LEVEL_ERRO]), 1) -// t.Assert(gstr.Count(content, "1 2 3"), 1) -// t.Assert(gstr.Count(content, "Stack"), 1) -// }) -// gtest.C(t, func(t *gtest.T) { -// path := gfile.TempDir(gtime.TimestampNanoStr()) -// file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) -// -// err := gfile.Mkdir(path) -// t.Assert(err, nil) -// defer gfile.Remove(path) -// -// Path(path).File(file).StackWithFilter("gogf").Stdout(false).Error(1, 2, 3) -// content := gfile.GetContents(gfile.Join(path, file)) -// t.Assert(gstr.Count(content, defaultLevelPrefixes[LEVEL_ERRO]), 1) -// t.Assert(gstr.Count(content, "1 2 3"), 1) -// t.Assert(gstr.Count(content, "Stack"), 0) -// }) -//} +func Test_StackWithFilter(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + path := gfile.TempDir(gtime.TimestampNanoStr()) + file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) + + err := gfile.Mkdir(path) + t.Assert(err, nil) + defer gfile.Remove(path) + + Path(path).File(file).StackWithFilter("none").Stdout(false).Error(1, 2, 3) + content := gfile.GetContents(gfile.Join(path, file)) + t.Assert(gstr.Count(content, defaultLevelPrefixes[LEVEL_ERRO]), 1) + t.Assert(gstr.Count(content, "1 2 3"), 1) + t.Assert(gstr.Count(content, "Stack"), 1) + fmt.Println("Content:") + fmt.Println(content) + }) + gtest.C(t, func(t *gtest.T) { + path := gfile.TempDir(gtime.TimestampNanoStr()) + file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) + + err := gfile.Mkdir(path) + t.Assert(err, nil) + defer gfile.Remove(path) + + Path(path).File(file).StackWithFilter("gogf").Stdout(false).Error(1, 2, 3) + content := gfile.GetContents(gfile.Join(path, file)) + t.Assert(gstr.Count(content, defaultLevelPrefixes[LEVEL_ERRO]), 1) + t.Assert(gstr.Count(content, "1 2 3"), 1) + t.Assert(gstr.Count(content, "Stack"), 0) + }) +} func Test_Header(t *testing.T) { gtest.C(t, func(t *gtest.T) {