MCPcopy Create free account
hub / github.com/DNAProject/DNA / TestNewLogFile

Function TestNewLogFile

common/log/log_test.go:66–88  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

64}
65
66func TestNewLogFile(t *testing.T) {
67 defer func() {
68 os.RemoveAll("Log/")
69 }()
70 InitLog(InfoLog, PATH, Stdout)
71 logfileNum1, err1 := ioutil.ReadDir("Log/")
72 if err1 != nil {
73 fmt.Println(err1)
74 return
75 }
76 logPrint()
77 isNeedNewFile := CheckIfNeedNewFile()
78 assert.NotEqual(t, isNeedNewFile, true)
79 ClosePrintLog()
80 time.Sleep(time.Second * 2)
81 InitLog(InfoLog, PATH, Stdout)
82 logfileNum2, err2 := ioutil.ReadDir("Log/")
83 if err2 != nil {
84 fmt.Println(err2)
85 return
86 }
87 assert.Equal(t, len(logfileNum1), (len(logfileNum2) - 1))
88}

Callers

nothing calls this directly

Calls 4

InitLogFunction · 0.85
logPrintFunction · 0.85
CheckIfNeedNewFileFunction · 0.85
ClosePrintLogFunction · 0.85

Tested by

no test coverage detected