MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / TestStackwalkDecoratorFlush

Function TestStackwalkDecoratorFlush

pkg/event/stackwalk_test.go:171–202  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

169}
170
171func TestStackwalkDecoratorFlush(t *testing.T) {
172 q := NewQueue(50, false, true)
173 q.RegisterListener(&DummyListener{})
174 cd := NewStackwalkDecorator(q)
175 defer cd.Stop()
176
177 e := &Event{
178 Type: CreateFile,
179 Tid: 2484,
180 PID: 859,
181 CPU: 1,
182 Seq: 2,
183 Name: "CreateFile",
184 Timestamp: time.Now(),
185 Category: File,
186 Params: Params{
187 params.FileObject: {Name: params.FileObject, Type: params.Uint64, Value: uint64(12456738026482168384)},
188 params.FilePath: {Name: params.FilePath, Type: params.UnicodeString, Value: "C:\\Windows\\system32\\user32.dll"},
189 params.FileType: {Name: params.FileType, Type: params.AnsiString, Value: "file"},
190 params.FileOperation: {Name: params.FileOperation, Type: params.Enum, Value: uint32(1), Enum: fs.FileCreateDispositions},
191 },
192 }
193
194 cd.Push(e)
195 assert.Len(t, cd.buckets[e.StackID()], 1)
196 time.Sleep(time.Millisecond * 3100)
197
198 evt := <-q.Events()
199 assert.Len(t, cd.buckets[e.StackID()], 0)
200 assert.Equal(t, CreateFile, evt.Type)
201 assert.False(t, evt.Params.Contains(params.Callstack))
202}

Callers

nothing calls this directly

Calls 10

RegisterListenerMethod · 0.95
StopMethod · 0.95
PushMethod · 0.95
StackIDMethod · 0.95
EventsMethod · 0.95
NewStackwalkDecoratorFunction · 0.85
EqualMethod · 0.80
ContainsMethod · 0.80
NewQueueFunction · 0.70
LenMethod · 0.45

Tested by

no test coverage detected