From 30308514aa948bec8a5ca63b7a2035ef86773cb7 Mon Sep 17 00:00:00 2001 From: DanielLavie Date: Thu, 19 Dec 2024 14:40:45 +0200 Subject: [PATCH] Using ddebpf.Manager instead of manager.Manager in consumer_test.go --- pkg/network/protocols/events/consumer_test.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pkg/network/protocols/events/consumer_test.go b/pkg/network/protocols/events/consumer_test.go index 5e9864b5a342a..1892d6e55b364 100644 --- a/pkg/network/protocols/events/consumer_test.go +++ b/pkg/network/protocols/events/consumer_test.go @@ -16,6 +16,7 @@ import ( "time" "unsafe" + ebpftelemetry "github.com/DataDog/datadog-agent/pkg/ebpf/telemetry" manager "github.com/DataDog/ebpf-manager" "github.com/cilium/ebpf" "github.com/cilium/ebpf/features" @@ -53,7 +54,7 @@ func TestConsumer(t *testing.T) { } } - consumer, err := NewConsumer("test", program, callback) + consumer, err := NewConsumer("test", program.Manager, callback) require.NoError(t, err) consumer.Start() @@ -61,7 +62,7 @@ func TestConsumer(t *testing.T) { require.NoError(t, err) // generate test events - generator := newEventGenerator(program, t) + generator := newEventGenerator(program.Manager, t) for i := 0; i < numEvents; i++ { generator.Generate(uint64(i)) } @@ -92,7 +93,7 @@ func TestInvalidBatchCountMetric(t *testing.T) { require.NoError(t, err) t.Cleanup(func() { program.Stop(manager.CleanAll) }) - consumer, err := NewConsumer("test", program, func([]uint64) {}) + consumer, err := NewConsumer("test", program.Manager, func([]uint64) {}) require.NoError(t, err) // We are creating a raw sample with a data length of 4, which is smaller than sizeOfBatch @@ -172,7 +173,7 @@ func (e *eventGenerator) Stop() { e.testFile.Close() } -func newEBPFProgram(c *config.Config) (*manager.Manager, error) { +func newEBPFProgram(c *config.Config) (*ddebpf.Manager, error) { bc, err := bytecode.GetReader(c.BPFDir, "usm_events_test-debug.o") if err != nil { return nil, err @@ -208,11 +209,13 @@ func newEBPFProgram(c *config.Config) (*manager.Manager, error) { }, } - Configure(config.New(), "test", m, &options) + ddEbpfManager := ddebpf.NewManager(m, "usm", &ebpftelemetry.ErrorsTelemetryModifier{}) + + Configure(config.New(), "test", ddEbpfManager.Manager, &options) err = m.InitWithOptions(bc, options) if err != nil { return nil, err } - return m, nil + return ddEbpfManager, nil }