Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Commit

Permalink
refactor: change cleanup for TestAddFileResolvedFields
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Rosiek <[email protected]>
  • Loading branch information
Dominik Rosiek committed Jun 16, 2021
1 parent c504ce0 commit 3d98cfd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions operator/builtin/input/file/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,16 @@ func TestAddFileResolvedFields(t *testing.T) {
require.NoError(t, err)

require.NoError(t, operator.Start(testutil.NewMockPersister("test")))
defer operator.Stop()

e := waitForOne(t, logReceived)
require.Equal(t, filepath.Base(symLinkPath), e.Attributes["file_name"])
require.Equal(t, symLinkPath, e.Attributes["file_path"])
require.Equal(t, filepath.Base(resolved), e.Attributes["file_name_resolved"])
require.Equal(t, resolved, e.Attributes["file_path_resolved"])

// Clean up (linux based host)
// Ignore error on windows host (The process cannot access the file because it is being used by another process.)
os.RemoveAll(dir)
operator.Stop()
err = os.RemoveAll(dir)
require.NoError(t, err)
}

// AddFileResolvedFields tests that the `file_name_resolved` and `file_path_resolved` fields are included
Expand Down

0 comments on commit 3d98cfd

Please sign in to comment.