Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore][receiver/windowseventlog] Fix lint on Windows #30311

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[chore][receiver/windowseventlog] Fix lint on Windows
  • Loading branch information
pjanotti committed Jan 5, 2024
commit f9df4c5d25be025b71796138e18a2e11c78e40f7
32 changes: 24 additions & 8 deletions receiver/windowseventlogreceiver/receiver_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,16 @@ func TestReadWindowsEventLogger(t *testing.T) {

err = receiver.Start(ctx, componenttest.NewNopHost())
require.NoError(t, err)
defer receiver.Shutdown(ctx)
defer func() {
require.NoError(t, receiver.Shutdown(ctx))
}()

src := "otel"
err = eventlog.InstallAsEventCreate(src, eventlog.Info|eventlog.Warning|eventlog.Error)
require.NoError(t, err)
defer eventlog.Remove(src)
defer func() {
require.NoError(t, eventlog.Remove(src))
}()

logger, err := eventlog.Open(src)
require.NoError(t, err)
Expand Down Expand Up @@ -144,11 +148,15 @@ func TestReadWindowsEventLoggerRaw(t *testing.T) {

err = receiver.Start(ctx, componenttest.NewNopHost())
require.NoError(t, err)
defer receiver.Shutdown(ctx)
defer func() {
require.NoError(t, receiver.Shutdown(ctx))
}()

src := "otel"
err = eventlog.InstallAsEventCreate(src, eventlog.Info|eventlog.Warning|eventlog.Error)
defer eventlog.Remove(src)
defer func() {
require.NoError(t, eventlog.Remove(src))
}()
require.NoError(t, err)

logger, err := eventlog.Open(src)
Expand Down Expand Up @@ -197,11 +205,15 @@ func TestReadWindowsEventLoggerWithExcludeProvider(t *testing.T) {

err = receiver.Start(ctx, componenttest.NewNopHost())
require.NoError(t, err)
defer receiver.Shutdown(ctx)
defer func() {
require.NoError(t, receiver.Shutdown(ctx))
}()

err = eventlog.InstallAsEventCreate(src, eventlog.Info|eventlog.Warning|eventlog.Error)
require.NoError(t, err)
defer eventlog.Remove(src)
defer func() {
require.NoError(t, eventlog.Remove(src))
}()

logger, err := eventlog.Open(src)
require.NoError(t, err)
Expand Down Expand Up @@ -237,10 +249,14 @@ func TestReadWindowsEventLoggerRawWithExcludeProvider(t *testing.T) {

err = receiver.Start(ctx, componenttest.NewNopHost())
require.NoError(t, err)
defer receiver.Shutdown(ctx)
defer func() {
require.NoError(t, receiver.Shutdown(ctx))
}()

err = eventlog.InstallAsEventCreate(src, eventlog.Info|eventlog.Warning|eventlog.Error)
defer eventlog.Remove(src)
defer func() {
require.NoError(t, eventlog.Remove(src))
}()
require.NoError(t, err)

logger, err := eventlog.Open(src)
Expand Down