diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b444581e..a687e57b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,3 +9,7 @@ updates: directory: "/" # Location of package manifests schedule: interval: "daily" + - package-ecosystem: "gomod" # See documentation for possible values + directory: "/tools/goctl" # Location of package manifests + schedule: + interval: "daily" diff --git a/.gitignore b/.gitignore index 77ba06dd..2c1d0b72 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ !api # ignore -.idea +**/.idea **/.DS_Store **/logs diff --git a/core/logx/rotatelogger_test.go b/core/logx/rotatelogger_test.go index 51cc888d..3dafc852 100644 --- a/core/logx/rotatelogger_test.go +++ b/core/logx/rotatelogger_test.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/zeromicro/go-zero/core/fs" + "github.com/zeromicro/go-zero/core/stringx" ) func TestDailyRotateRuleMarkRotated(t *testing.T) { @@ -232,6 +233,23 @@ func TestRotateLoggerWithSizeLimitRotateRuleMayCompressFileTrue(t *testing.T) { assert.NotNil(t, err) } +func TestRotateLoggerWithSizeLimitRotateRuleMayCompressFileFailed(t *testing.T) { + old := os.Stdout + os.Stdout = os.NewFile(0, os.DevNull) + defer func() { + os.Stdout = old + }() + + filename := stringx.RandId() + logger, err := NewLogger(filename, new(SizeLimitRotateRule), true) + defer os.Remove(filename) + if assert.NoError(t, err) { + assert.NotPanics(t, func() { + logger.maybeCompressFile(stringx.RandId()) + }) + } +} + func TestRotateLoggerWithSizeLimitRotateRuleRotate(t *testing.T) { filename, err := fs.TempFilenameWithText("foo") assert.Nil(t, err)