fix test error on ubuntu (#1048)

This commit is contained in:
Kevin Wan
2021-09-15 13:31:20 +08:00
committed by GitHub
parent 5c6a3132eb
commit f4bb9f5635
2 changed files with 9 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ package logx
import (
"os"
"path/filepath"
"syscall"
"testing"
"time"
@@ -97,7 +98,13 @@ func TestRotateLoggerRotate(t *testing.T) {
}()
}
err = logger.rotate()
assert.Nil(t, err)
switch v := err.(type) {
case *os.LinkError:
// avoid rename error on ubuntu
assert.Equal(t, syscall.EXDEV, v.Err)
default:
assert.Nil(t, err)
}
}
func TestRotateLoggerWrite(t *testing.T) {

View File

@@ -1,3 +1,4 @@
//go:build !linux
// +build !linux
package internal