Skip to content

Commit

Permalink
💚 ci: fix ci error on Windows, only test syslog on !Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jul 8, 2023
1 parent 3923679 commit 43c24a5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
18 changes: 0 additions & 18 deletions handler/handler_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package handler_test

import (
"log/syslog"
"testing"

"github.com/gookit/goutil"
"github.com/gookit/goutil/errorx"
"github.com/gookit/goutil/fsutil"
"github.com/gookit/goutil/sysutil"
"github.com/gookit/goutil/testutil/assert"
"github.com/gookit/slog"
"github.com/gookit/slog/handler"
Expand Down Expand Up @@ -146,22 +144,6 @@ func TestLockWrapper_Lock(t *testing.T) {
assert.Eq(t, 2, a)
}

func TestNewSysLogHandler(t *testing.T) {
if sysutil.IsWin() {
t.Skip("skip test on windows")
return
}

h, err := handler.NewSysLogHandler(syslog.LOG_INFO, "slog")
assert.NoErr(t, err)

err = h.Handle(newLogRecord("test syslog handler"))
assert.NoErr(t, err)

assert.NoErr(t, h.Flush())
assert.NoErr(t, h.Close())
}

func logAllLevel(log slog.SLogger, msg string) {
for _, level := range slog.AllLevels {
log.Log(level, msg)
Expand Down
2 changes: 1 addition & 1 deletion handler/syslog.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !windows && !nacl && !plan9
//go:build !windows && !plan9

package handler

Expand Down
22 changes: 22 additions & 0 deletions handler/syslog_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//go:build !windows && !plan9

package handler_test

import (
"log/syslog"
"testing"

"github.com/gookit/goutil/testutil/assert"
"github.com/gookit/slog/handler"
)

func TestNewSysLogHandler(t *testing.T) {
h, err := handler.NewSysLogHandler(syslog.LOG_INFO, "slog")
assert.NoErr(t, err)

err = h.Handle(newLogRecord("test syslog handler"))
assert.NoErr(t, err)

assert.NoErr(t, h.Flush())
assert.NoErr(t, h.Close())
}

0 comments on commit 43c24a5

Please sign in to comment.