Skip to content

Commit

Permalink
fix macos and stress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
safchain committed Nov 24, 2023
1 parent 52d5e10 commit 5319404
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 34 deletions.
6 changes: 0 additions & 6 deletions pkg/security/probe/probe_others.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

"github.com/DataDog/datadog-agent/pkg/security/config"
"github.com/DataDog/datadog-agent/pkg/security/probe/kfilters"
"github.com/DataDog/datadog-agent/pkg/security/resolvers"
"github.com/DataDog/datadog-agent/pkg/security/secl/compiler/eval"
"github.com/DataDog/datadog-agent/pkg/security/secl/model"
"github.com/DataDog/datadog-agent/pkg/security/secl/rules"
Expand Down Expand Up @@ -87,11 +86,6 @@ func (p *Probe) StatsPollingInterval() time.Duration {
return p.Config.Probe.StatsPollingInterval
}

// GetResolvers returns the resolvers of Probe
func (p *Probe) GetResolvers() *resolvers.Resolvers {
return nil
}

// FlushDiscarders invalidates all the discarders
func (p *Probe) FlushDiscarders() error {
return nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/security/probe/probe_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ func (p *WindowsProbe) NewEvent() *model.Event {
func (p *WindowsProbe) HandleActions(_ *rules.Rule, _ eval.Event) {}

// AddDiscarderPushedCallback add a callback to the list of func that have to be called when a discarder is pushed to kernel
func (p *EBPFLessProbe) AddDiscarderPushedCallback(_ DiscarderPushedCallback) {}
func (p *WindowsProbe) AddDiscarderPushedCallback(_ DiscarderPushedCallback) {}

// GetEventTags returns the event tags
func (p *EBPFLessProbe) GetEventTags(_ string) []string {
func (p *WindowsProbe) GetEventTags(_ string) []string {
return nil
}

Expand Down
24 changes: 0 additions & 24 deletions pkg/security/resolvers/resolvers_others.go

This file was deleted.

16 changes: 14 additions & 2 deletions pkg/security/tests/stress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"testing"
"time"

sprobe "github.com/DataDog/datadog-agent/pkg/security/probe"
"github.com/DataDog/datadog-agent/pkg/security/secl/model"
"github.com/DataDog/datadog-agent/pkg/security/secl/rules"
)
Expand All @@ -41,6 +42,11 @@ func stressOpen(t *testing.T, rule *rules.RuleDefinition, pathname string, size
}
defer test.Close()

p, ok := test.probe.PlatformProbe.(*sprobe.EBPFProbe)
if !ok {
b.Skip("not supported")
}

testFolder, _, err := test.Path(path.Dir(pathname))
if err != nil {
t.Fatal(err)
Expand All @@ -53,7 +59,8 @@ func stressOpen(t *testing.T, rule *rules.RuleDefinition, pathname string, size
t.Fatal(err)
}

eventStreamMonitor := test.probe.GetMonitors().GetEventStreamMonitor()
eventStreamMonitor := p.GetMonitors().GetEventStreamMonitor()

eventStreamMonitor.GetAndResetLostCount("events", -1)
eventStreamMonitor.GetKernelLostCount("events", -1, model.MaxKernelEventType)

Expand Down Expand Up @@ -183,6 +190,11 @@ func stressExec(t *testing.T, rule *rules.RuleDefinition, pathname string, execu
}
defer test.Close()

p, ok := test.probe.PlatformProbe.(*sprobe.EBPFProbe)
if !ok {
b.Skip("not supported")
}

testFolder, _, err := test.Path(path.Dir(pathname))
if err != nil {
t.Fatal(err)
Expand All @@ -195,7 +207,7 @@ func stressExec(t *testing.T, rule *rules.RuleDefinition, pathname string, execu
t.Fatal(err)
}

eventStreamMonitor := test.probe.GetMonitors().GetEventStreamMonitor()
eventStreamMonitor := p.GetMonitors().GetEventStreamMonitor()
eventStreamMonitor.GetAndResetLostCount("events", -1)
eventStreamMonitor.GetKernelLostCount("events", -1, model.MaxKernelEventType)

Expand Down

0 comments on commit 5319404

Please sign in to comment.