Skip to content

Commit badef31

Browse files
committed
OneShot() wineventlog
1 parent ccde67d commit badef31

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

pkg/acquisition/modules/wineventlog/run_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (s *Source) getEvents(out chan pipeline.Event, t *tomb.Tomb) error {
119119
}
120120
}
121121

122-
func (s *Source) OneShotAcquisition(ctx context.Context, out chan pipeline.Event, t *tomb.Tomb) error {
122+
func (s *Source) OneShot(ctx context.Context, out chan pipeline.Event) error {
123123
handle, err := wevtapi.EvtQuery(localMachine, s.evtConfig.ChannelPath, s.evtConfig.Query, s.evtConfig.Flags)
124124
if err != nil {
125125
return fmt.Errorf("EvtQuery failed: %v", err)
@@ -137,7 +137,7 @@ func (s *Source) OneShotAcquisition(ctx context.Context, out chan pipeline.Event
137137
OUTER_LOOP:
138138
for {
139139
select {
140-
case <-t.Dying():
140+
case <-ctx.Done():
141141
s.logger.Infof("wineventlog is dying")
142142
return nil
143143
default:

pkg/acquisition/modules/wineventlog/stub.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (*Source) SupportedModes() []string {
4141
return []string{configuration.TAIL_MODE, configuration.CAT_MODE}
4242
}
4343

44-
func (*Source) OneShotAcquisition(_ context.Context, _ chan pipeline.Event, _ *tomb.Tomb) error {
44+
func (*Source) OneShot(_ context.Context, _ chan pipeline.Event) error {
4545
return nil
4646
}
4747

pkg/acquisition/modules/wineventlog/wineventlog_windows_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ event_ids:
243243
}
244244
}
245245

246-
func TestOneShotAcquisition(t *testing.T) {
246+
func TestOneShot(t *testing.T) {
247247
ctx := t.Context()
248248

249249
tests := []struct {
@@ -289,7 +289,6 @@ func TestOneShotAcquisition(t *testing.T) {
289289
for _, test := range tests {
290290
t.Run(test.name, func(t *testing.T) {
291291
lineCount := 0
292-
to := &tomb.Tomb{}
293292
c := make(chan pipeline.Event)
294293
f := Source{}
295294

@@ -304,13 +303,13 @@ func TestOneShotAcquisition(t *testing.T) {
304303
select {
305304
case <-c:
306305
lineCount++
307-
case <-to.Dying():
306+
case <-ctx.Done():
308307
return
309308
}
310309
}
311310
}()
312311

313-
err = f.OneShotAcquisition(ctx, c, to)
312+
err = f.OneShot(ctx, c)
314313
cstest.RequireErrorContains(t, err, test.expectedErr)
315314

316315
if test.expectedErr != "" {

pkg/acquisition/wineventlog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var (
1010
// verify interface compliance
1111
_ DataSource = (*wineventlogacquisition.Source)(nil)
1212
_ DSNConfigurer = (*wineventlogacquisition.Source)(nil)
13-
_ Fetcher = (*wineventlogacquisition.Source)(nil)
13+
_ BatchFetcher = (*wineventlogacquisition.Source)(nil)
1414
_ Tailer = (*wineventlogacquisition.Source)(nil)
1515
_ MetricsProvider = (*wineventlogacquisition.Source)(nil)
1616
)

0 commit comments

Comments
 (0)