From 94d1dc59513b4969b040bac9cd0e64ec422f4f78 Mon Sep 17 00:00:00 2001 From: jabdr Date: Mon, 26 Aug 2024 14:11:27 +0200 Subject: [PATCH] fix: broken TestConcurrentWriterSuccess on windows (#1138) --- internal/auditlog/concurrent_writer_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/auditlog/concurrent_writer_test.go b/internal/auditlog/concurrent_writer_test.go index f3511bec5..0ceecf3d1 100644 --- a/internal/auditlog/concurrent_writer_test.go +++ b/internal/auditlog/concurrent_writer_test.go @@ -12,7 +12,6 @@ import ( "fmt" "io/fs" "os" - "path" "path/filepath" "reflect" "testing" @@ -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{ @@ -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 {