Skip to content

Commit

Permalink
fix: broken TestConcurrentWriterSuccess on windows (#1138)
Browse files Browse the repository at this point in the history
  • Loading branch information
jabdr committed Aug 26, 2024
1 parent 5593008 commit 94d1dc5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/auditlog/concurrent_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"fmt"
"io/fs"
"os"
"path"
"path/filepath"
"reflect"
"testing"
Expand Down Expand Up @@ -104,11 +103,15 @@ func TestConcurrentWriterSuccess(t *testing.T) {
DirMode: fs.FileMode(0777),
Formatter: &jsonFormatter{},
}
if err := file.Close(); err != nil {
t.Error(err)
}

writer := &concurrentWriter{}
if err := writer.Init(config); err != nil {
t.Error("failed to init concurrent logger", err)
}
defer writer.Close()

ts := time.Now()
expectedLog := &Log{
Expand All @@ -130,7 +133,7 @@ func TestConcurrentWriterSuccess(t *testing.T) {
}

fileName := fmt.Sprintf("/%s-%s", ts.Format("20060102-150405"), expectedLog.Transaction().ID())
logFile := path.Join(dir, ts.Format("20060102"), ts.Format("20060102-1504"), fileName)
logFile := filepath.Join(dir, ts.Format("20060102"), ts.Format("20060102-1504"), fileName)

logData, err := os.ReadFile(logFile)
if err != nil {
Expand Down

0 comments on commit 94d1dc5

Please sign in to comment.