Skip to content

Commit e9d8099

Browse files
committed
fix(tests): Use parent process id for test assertion
1 parent 846af3d commit e9d8099

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/etw/source_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ func TestEventSourceAllEvents(t *testing.T) {
421421
return nil
422422
},
423423
func(e *event.Event) bool {
424-
return e.IsCreateProcess() && e.CurrentPid() &&
424+
return e.IsCreateProcess() && e.Params.MustGetUint32(params.ProcessParentID) == uint32(os.Getpid()) &&
425425
strings.EqualFold(e.GetParamAsString(params.ProcessName), "notepad.exe")
426426
},
427427
false,
@@ -876,7 +876,7 @@ func testCallstackEnrichment(t *testing.T, hsnap handle.Snapshotter, psnap ps.Sn
876876
return nil
877877
},
878878
func(e *event.Event) bool {
879-
if e.IsCreateProcess() && e.CurrentPid() &&
879+
if e.IsCreateProcess() && e.Params.MustGetUint32(params.ProcessParentID) == uint32(os.Getpid()) &&
880880
strings.EqualFold(e.GetParamAsString(params.ProcessName), "notepad.exe") {
881881
callstack := e.Callstack.String()
882882
log.Infof("create process event %s: %s", e.String(), callstack)

0 commit comments

Comments
 (0)