Skip to content

Commit

Permalink
close writer to force sync to disk in rotation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BinaryFissionGames committed Feb 18, 2022
1 parent 08644fc commit 6a61f82
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions operator/builtin/input/file/rotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"testing"
"time"

"github.com/observiq/nanojack"
"github.com/observiq/stanza/entry"
"github.com/observiq/stanza/operator/helper"
"github.com/observiq/stanza/testutil"
Expand Down Expand Up @@ -254,6 +255,9 @@ func (rt rotationTest) run(tc rotationTest, copyTruncate, sequential bool) func(
time.Sleep(tc.writeInterval)
}

// Close the logger's writer to force a sync to disk
require.NoError(t, logger.Writer().(*nanojack.Logger).Close())

received := make([]string, 0, tc.totalLines)
LOOP:
for {
Expand Down

0 comments on commit 6a61f82

Please sign in to comment.