From 12efa054cda1612208fd39b7ea18cb86a11bc39f Mon Sep 17 00:00:00 2001 From: David Ortiz Date: Wed, 20 Nov 2024 10:44:42 +0100 Subject: [PATCH 1/3] [tagger/mock] Refactor to use fake impl directly and avoid unwanted dependencies --- .../tagger/{impl => impl-mock}/fake_tagger.go | 39 +++++- comp/core/tagger/impl/tagger.go | 3 +- comp/core/tagger/mock/mock.go | 123 +----------------- 3 files changed, 36 insertions(+), 129 deletions(-) rename comp/core/tagger/{impl => impl-mock}/fake_tagger.go (82%) diff --git a/comp/core/tagger/impl/fake_tagger.go b/comp/core/tagger/impl-mock/fake_tagger.go similarity index 82% rename from comp/core/tagger/impl/fake_tagger.go rename to comp/core/tagger/impl-mock/fake_tagger.go index 31a71a1b8bff5b..7d453916b86a0b 100644 --- a/comp/core/tagger/impl/fake_tagger.go +++ b/comp/core/tagger/impl-mock/fake_tagger.go @@ -3,32 +3,54 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016-present Datadog, Inc. -package taggerimpl +package mock import ( "context" + "net/http" "strconv" + api "github.com/DataDog/datadog-agent/comp/api/api/def" taggercommon "github.com/DataDog/datadog-agent/comp/core/tagger/common" tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def" "github.com/DataDog/datadog-agent/comp/core/tagger/tagstore" "github.com/DataDog/datadog-agent/comp/core/tagger/telemetry" "github.com/DataDog/datadog-agent/comp/core/tagger/types" - taggertypes "github.com/DataDog/datadog-agent/pkg/tagger/types" "github.com/DataDog/datadog-agent/pkg/tagset" ) +// Mock implements mock-specific methods for the tagger component. +type Mock interface { + tagger.Component + + // SetTags allows to set tags in the mock fake tagger + SetTags(entityID types.EntityID, source string, low, orch, high, std []string) + + // SetGlobalTags allows to set tags in store for the global entity + SetGlobalTags(low, orch, high, std []string) +} + // FakeTagger is a fake implementation of the tagger interface type FakeTagger struct { errors map[string]error store *tagstore.TagStore } -func newFakeTagger() *FakeTagger { - return &FakeTagger{ - errors: make(map[string]error), - store: tagstore.NewTagStore(nil), +// Provides is a struct containing the mock and the endpoint +type Provides struct { + Comp Mock + Endpoint api.AgentEndpointProvider +} + +// New instantiates a new fake tagger +func New() Provides { + return Provides{ + Comp: &FakeTagger{ + errors: make(map[string]error), + store: tagstore.NewTagStore(nil), + }, + Endpoint: api.NewAgentEndpointProvider(mockHandleRequest, "/tagger-list", "GET"), } } @@ -170,3 +192,8 @@ func (f *FakeTagger) ChecksCardinality() types.TagCardinality { func (f *FakeTagger) DogstatsdCardinality() types.TagCardinality { return types.LowCardinality } + +// mockHandleRequest is a simple mocked http.Handler function to test the route is registered correctly on the api component +func mockHandleRequest(w http.ResponseWriter, _ *http.Request) { + w.Write([]byte("OK")) +} diff --git a/comp/core/tagger/impl/tagger.go b/comp/core/tagger/impl/tagger.go index c88d3a5eb55583..450e48cb212d4f 100644 --- a/comp/core/tagger/impl/tagger.go +++ b/comp/core/tagger/impl/tagger.go @@ -27,6 +27,7 @@ import ( log "github.com/DataDog/datadog-agent/comp/core/log/def" taggercommon "github.com/DataDog/datadog-agent/comp/core/tagger/common" tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def" + taggermock "github.com/DataDog/datadog-agent/comp/core/tagger/mock" "github.com/DataDog/datadog-agent/comp/core/tagger/telemetry" "github.com/DataDog/datadog-agent/comp/core/tagger/types" "github.com/DataDog/datadog-agent/comp/core/tagger/utils" @@ -142,7 +143,7 @@ func NewTaggerClient(params tagger.Params, cfg config.Component, wmeta workloadm var err error telemetryStore := telemetry.NewStore(telemetryComp) if params.UseFakeTagger { - defaultTagger = newFakeTagger() + defaultTagger = taggermock.New().Comp } else { defaultTagger, err = newLocalTagger(cfg, wmeta, telemetryStore) } diff --git a/comp/core/tagger/mock/mock.go b/comp/core/tagger/mock/mock.go index 30fcabd7ef0b8d..26b9781c871ec7 100644 --- a/comp/core/tagger/mock/mock.go +++ b/comp/core/tagger/mock/mock.go @@ -4,127 +4,20 @@ // Copyright 2016-present Datadog, Inc. //go:build test -// +build test // Package mock contains the implementation of the mock for the tagger component. package mock import ( - "net/http" "testing" - "go.uber.org/fx" - - "github.com/stretchr/testify/assert" - - api "github.com/DataDog/datadog-agent/comp/api/api/def" - "github.com/DataDog/datadog-agent/comp/core/config" - log "github.com/DataDog/datadog-agent/comp/core/log/def" - logmock "github.com/DataDog/datadog-agent/comp/core/log/mock" - "github.com/DataDog/datadog-agent/comp/core/sysprobeconfig/sysprobeconfigimpl" - tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def" - taggerimpl "github.com/DataDog/datadog-agent/comp/core/tagger/impl" - "github.com/DataDog/datadog-agent/comp/core/tagger/types" - "github.com/DataDog/datadog-agent/comp/core/telemetry" - noopTelemetry "github.com/DataDog/datadog-agent/comp/core/telemetry/noopsimpl" - "github.com/DataDog/datadog-agent/comp/core/telemetry/telemetryimpl" - workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def" - workloadmetafx "github.com/DataDog/datadog-agent/comp/core/workloadmeta/fx" - configmock "github.com/DataDog/datadog-agent/pkg/config/mock" "github.com/DataDog/datadog-agent/pkg/util/fxutil" ) -// Mock implements mock-specific methods for the tagger component. -type Mock interface { - tagger.Component - - // SetTags allows to set tags in the mock fake tagger - SetTags(entityID types.EntityID, source string, low, orch, high, std []string) - - // SetGlobalTags allows to set tags in store for the global entity - SetGlobalTags(low, orch, high, std []string) -} - -// mockTaggerClient is a mock of the tagger Component -type mockTaggerClient struct { - *taggerimpl.TaggerWrapper -} - -// mockHandleRequest is a simple mocked http.Handler function to test the route is registered correctly on the api component -func (m *mockTaggerClient) mockHandleRequest(w http.ResponseWriter, _ *http.Request) { - w.Write([]byte("OK")) -} - -// New returns a Mock -func New(t testing.TB) Mock { - c := configmock.New(t) - params := tagger.Params{ - UseFakeTagger: true, - } - logComponent := logmock.New(t) - wmeta := fxutil.Test[workloadmeta.Component](t, - fx.Provide(func() log.Component { return logComponent }), - fx.Provide(func() config.Component { return c }), - workloadmetafx.Module(workloadmeta.NewParams()), - ) - - tagger, err := taggerimpl.NewTaggerClient(params, c, wmeta, logComponent, noopTelemetry.GetCompatComponent()) - - assert.NoError(t, err) - - return &mockTaggerClient{ - tagger, - } -} - -// Provides is a struct containing the mock and the endpoint -type Provides struct { - fx.Out - - Comp Mock - Endpoint api.AgentEndpointProvider -} - -type dependencies struct { - fx.In - - Config config.Component - Log log.Component - WMeta workloadmeta.Component - Telemetry telemetry.Component -} - -// NewMock returns a Provides -func NewMock(deps dependencies) (Provides, error) { - params := tagger.Params{ - UseFakeTagger: true, - } - - tagger, err := taggerimpl.NewTaggerClient(params, deps.Config, deps.WMeta, deps.Log, deps.Telemetry) - if err != nil { - return Provides{}, err - } - - c := &mockTaggerClient{ - tagger, - } - return Provides{ - Comp: c, - Endpoint: api.NewAgentEndpointProvider(c.mockHandleRequest, "/tagger-list", "GET"), - }, nil -} - // Module is a module containing the mock, useful for testing func Module() fxutil.Module { return fxutil.Component( - fx.Provide(NewMock), - fx.Supply(config.Params{}), - fx.Supply(log.Params{}), - fx.Provide(func(t testing.TB) log.Component { return logmock.New(t) }), - config.MockModule(), - sysprobeconfigimpl.MockModule(), - workloadmetafx.Module(workloadmeta.NewParams()), - telemetryimpl.MockModule(), + fxutil.ProvideComponentConstructor(New), ) } @@ -132,17 +25,3 @@ func Module() fxutil.Module { func SetupFakeTagger(t testing.TB) Mock { return fxutil.Test[Mock](t, Module()) } - -// SetTags calls faketagger SetTags which sets the tags for an entity -func (m *mockTaggerClient) SetTags(entity types.EntityID, source string, low, orch, high, std []string) { - if v, ok := m.TaggerWrapper.GetDefaultTagger().(*taggerimpl.FakeTagger); ok { - v.SetTags(entity, source, low, orch, high, std) - } -} - -// SetGlobalTags calls faketagger SetGlobalTags which sets the tags for the global entity -func (m *mockTaggerClient) SetGlobalTags(low, orch, high, std []string) { - if v, ok := m.TaggerWrapper.GetDefaultTagger().(*taggerimpl.FakeTagger); ok { - v.SetGlobalTags(low, orch, high, std) - } -} From 51920b16685b6b6d62efa340cd67a6da1c13da95 Mon Sep 17 00:00:00 2001 From: David Ortiz Date: Wed, 20 Nov 2024 11:57:59 +0100 Subject: [PATCH 2/3] Adapt callers --- comp/core/tagger/impl/tagger_test.go | 11 ++++++----- comp/core/tagger/{impl-mock => mock}/fake_tagger.go | 0 .../cluster/kubernetesapiserver/events_common_test.go | 2 +- pkg/logs/internal/util/adlistener/ad_test.go | 2 +- pkg/logs/schedulers/cca/scheduler_test.go | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) rename comp/core/tagger/{impl-mock => mock}/fake_tagger.go (100%) diff --git a/comp/core/tagger/impl/tagger_test.go b/comp/core/tagger/impl/tagger_test.go index 74f37dc1a5ae6e..10bd2d3ebb5f12 100644 --- a/comp/core/tagger/impl/tagger_test.go +++ b/comp/core/tagger/impl/tagger_test.go @@ -17,6 +17,7 @@ import ( log "github.com/DataDog/datadog-agent/comp/core/log/def" logmock "github.com/DataDog/datadog-agent/comp/core/log/mock" tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def" + "github.com/DataDog/datadog-agent/comp/core/tagger/mock" "github.com/DataDog/datadog-agent/comp/core/tagger/types" noopTelemetry "github.com/DataDog/datadog-agent/comp/core/telemetry/noopsimpl" workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def" @@ -67,7 +68,7 @@ func TestEnrichTags(t *testing.T) { tagger, err := NewTaggerClient(params, c, wmeta, logComponent, noopTelemetry.GetCompatComponent()) assert.NoError(t, err) - fakeTagger := tagger.defaultTagger.(*FakeTagger) + fakeTagger := tagger.defaultTagger.(*mock.FakeTagger) containerName, initContainerName, containerID, initContainerID, podUID := "container-name", "init-container-name", "container-id", "init-container-id", "pod-uid" @@ -191,7 +192,7 @@ func TestEnrichTagsOrchestrator(t *testing.T) { tagger, err := NewTaggerClient(params, c, wmeta, logComponent, noopTelemetry.GetCompatComponent()) assert.NoError(t, err) - fakeTagger := tagger.defaultTagger.(*FakeTagger) + fakeTagger := tagger.defaultTagger.(*mock.FakeTagger) fakeTagger.SetTags(types.NewEntityID(types.ContainerID, "bar"), "fooSource", []string{"container-low"}, []string{"container-orch"}, nil, nil) tb := tagset.NewHashingTagsAccumulator() @@ -215,7 +216,7 @@ func TestEnrichTagsOptOut(t *testing.T) { tagger, err := NewTaggerClient(params, c, wmeta, logComponent, noopTelemetry.GetCompatComponent()) assert.NoError(t, err) - fakeTagger := tagger.defaultTagger.(*FakeTagger) + fakeTagger := tagger.defaultTagger.(*mock.FakeTagger) fakeTagger.SetTags(types.NewEntityID(types.EntityIDPrefix("foo"), "bar"), "fooSource", []string{"container-low"}, []string{"container-orch"}, nil, nil) tb := tagset.NewHashingTagsAccumulator() @@ -307,7 +308,7 @@ func TestAgentTags(t *testing.T) { tagger, err := NewTaggerClient(params, c, wmeta, logComponent, noopTelemetry.GetCompatComponent()) assert.NoError(t, err) - fakeTagger := tagger.defaultTagger.(*FakeTagger) + fakeTagger := tagger.defaultTagger.(*mock.FakeTagger) agentContainerID, podUID := "agentContainerID", "podUID" mockMetricsProvider := collectormock.NewMetricsProvider() @@ -346,7 +347,7 @@ func TestGlobalTags(t *testing.T) { tagger, err := NewTaggerClient(params, c, wmeta, logComponent, noopTelemetry.GetCompatComponent()) assert.NoError(t, err) - fakeTagger := tagger.defaultTagger.(*FakeTagger) + fakeTagger := tagger.defaultTagger.(*mock.FakeTagger) fakeTagger.SetTags(types.NewEntityID(types.ContainerID, "bar"), "fooSource", []string{"container-low"}, []string{"container-orch"}, []string{"container-high"}, nil) fakeTagger.SetGlobalTags([]string{"global-low"}, []string{"global-orch"}, []string{"global-high"}, nil) diff --git a/comp/core/tagger/impl-mock/fake_tagger.go b/comp/core/tagger/mock/fake_tagger.go similarity index 100% rename from comp/core/tagger/impl-mock/fake_tagger.go rename to comp/core/tagger/mock/fake_tagger.go diff --git a/pkg/collector/corechecks/cluster/kubernetesapiserver/events_common_test.go b/pkg/collector/corechecks/cluster/kubernetesapiserver/events_common_test.go index 53fe552d085815..af0efc2196462c 100644 --- a/pkg/collector/corechecks/cluster/kubernetesapiserver/events_common_test.go +++ b/pkg/collector/corechecks/cluster/kubernetesapiserver/events_common_test.go @@ -53,7 +53,7 @@ func TestGetDDAlertType(t *testing.T) { } func Test_getInvolvedObjectTags(t *testing.T) { - taggerInstance := mockTagger.New(t) + taggerInstance := mockTagger.New().Comp taggerInstance.SetTags(types.NewEntityID(types.KubernetesPodUID, "nginx"), "workloadmeta-kubernetes_pod", nil, []string{"additional_pod_tag:nginx"}, nil, nil) taggerInstance.SetTags(types.NewEntityID(types.KubernetesDeployment, "workload-redis/my-deployment-1"), "workloadmeta-kubernetes_deployment", nil, []string{"deployment_tag:redis-1"}, nil, nil) taggerInstance.SetTags(types.NewEntityID(types.KubernetesDeployment, "default/my-deployment-2"), "workloadmeta-kubernetes_deployment", nil, []string{"deployment_tag:redis-2"}, nil, nil) diff --git a/pkg/logs/internal/util/adlistener/ad_test.go b/pkg/logs/internal/util/adlistener/ad_test.go index d54417f77de848..58ef03be889f9f 100644 --- a/pkg/logs/internal/util/adlistener/ad_test.go +++ b/pkg/logs/internal/util/adlistener/ad_test.go @@ -32,7 +32,7 @@ func TestListenersGetScheduleCalls(t *testing.T) { autodiscoveryimpl.MockModule(), workloadmetafxmock.MockModule(workloadmeta.NewParams()), core.MockBundle(), - fx.Provide(taggermock.NewMock), + taggermock.Module(), ) got1 := make(chan struct{}, 1) diff --git a/pkg/logs/schedulers/cca/scheduler_test.go b/pkg/logs/schedulers/cca/scheduler_test.go index 0ab1cdb18175ba..8f12ac4dd9114e 100644 --- a/pkg/logs/schedulers/cca/scheduler_test.go +++ b/pkg/logs/schedulers/cca/scheduler_test.go @@ -32,7 +32,7 @@ func setup(t *testing.T) (scheduler *Scheduler, ac autodiscovery.Component, spy autodiscoveryimpl.MockModule(), workloadmetafxmock.MockModule(workloadmeta.NewParams()), core.MockBundle(), - fx.Provide(taggermock.NewMock), + taggermock.Module(), ) scheduler = New(ac).(*Scheduler) spy = &schedulers.MockSourceManager{} From 1c32aa0a3404b500efaee5b538282f73f8d3b50d Mon Sep 17 00:00:00 2001 From: David Ortiz Date: Wed, 20 Nov 2024 14:16:46 +0100 Subject: [PATCH 3/3] Add missing components in places where the old tagger helper added them --- comp/api/api/apiimpl/api_test.go | 9 +++++++++ comp/api/api/apiimpl/internal/agent/agent_test.go | 9 +++++++++ comp/process/agent/agentimpl/agent_linux_test.go | 12 ++++++++++++ comp/process/agent/agentimpl/agent_test.go | 7 +++++++ 4 files changed, 37 insertions(+) diff --git a/comp/api/api/apiimpl/api_test.go b/comp/api/api/apiimpl/api_test.go index f24241bf2f1503..d92e8f1e4fa480 100644 --- a/comp/api/api/apiimpl/api_test.go +++ b/comp/api/api/apiimpl/api_test.go @@ -26,11 +26,16 @@ import ( "github.com/DataDog/datadog-agent/comp/core/autodiscovery/autodiscoveryimpl" "github.com/DataDog/datadog-agent/comp/core/config" "github.com/DataDog/datadog-agent/comp/core/hostname/hostnameimpl" + log "github.com/DataDog/datadog-agent/comp/core/log/def" + logmock "github.com/DataDog/datadog-agent/comp/core/log/mock" remoteagentregistry "github.com/DataDog/datadog-agent/comp/core/remoteagentregistry/def" "github.com/DataDog/datadog-agent/comp/core/secrets/secretsimpl" tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def" taggermock "github.com/DataDog/datadog-agent/comp/core/tagger/mock" "github.com/DataDog/datadog-agent/comp/core/telemetry" + "github.com/DataDog/datadog-agent/comp/core/telemetry/telemetryimpl" + workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def" + workloadmetafxmock "github.com/DataDog/datadog-agent/comp/core/workloadmeta/fx-mock" "github.com/DataDog/datadog-agent/comp/dogstatsd/pidmap/pidmapimpl" replaymock "github.com/DataDog/datadog-agent/comp/dogstatsd/replay/fx-mock" dogstatsdServer "github.com/DataDog/datadog-agent/comp/dogstatsd/server" @@ -92,6 +97,10 @@ func getTestAPIServer(t *testing.T, params config.MockParams) testdeps { } }), fx.Provide(func() remoteagentregistry.Component { return nil }), + telemetryimpl.MockModule(), + config.MockModule(), + workloadmetafxmock.MockModule(workloadmeta.NewParams()), + fx.Provide(func(t testing.TB) log.Component { return logmock.New(t) }), ) } diff --git a/comp/api/api/apiimpl/internal/agent/agent_test.go b/comp/api/api/apiimpl/internal/agent/agent_test.go index 98823634836cec..b842e456a431d0 100644 --- a/comp/api/api/apiimpl/internal/agent/agent_test.go +++ b/comp/api/api/apiimpl/internal/agent/agent_test.go @@ -23,8 +23,13 @@ import ( "github.com/DataDog/datadog-agent/comp/collector/collector" "github.com/DataDog/datadog-agent/comp/core/autodiscovery" "github.com/DataDog/datadog-agent/comp/core/autodiscovery/autodiscoveryimpl" + "github.com/DataDog/datadog-agent/comp/core/config" "github.com/DataDog/datadog-agent/comp/core/flare/flareimpl" "github.com/DataDog/datadog-agent/comp/core/hostname/hostnameinterface" + log "github.com/DataDog/datadog-agent/comp/core/log/def" + logmock "github.com/DataDog/datadog-agent/comp/core/log/mock" + "github.com/DataDog/datadog-agent/comp/core/telemetry/telemetryimpl" + workloadmetafx "github.com/DataDog/datadog-agent/comp/core/workloadmeta/fx" "github.com/DataDog/datadog-agent/comp/core/secrets" "github.com/DataDog/datadog-agent/comp/core/secrets/secretsimpl" @@ -108,6 +113,10 @@ func getComponentDeps(t *testing.T) handlerdeps { autodiscoveryimpl.MockModule(), ), settingsimpl.MockModule(), + config.MockModule(), + fx.Provide(func(t testing.TB) log.Component { return logmock.New(t) }), + workloadmetafx.Module(workloadmeta.NewParams()), + telemetryimpl.MockModule(), ) } diff --git a/comp/process/agent/agentimpl/agent_linux_test.go b/comp/process/agent/agentimpl/agent_linux_test.go index bbfcf36a660819..e155fdfb551baa 100644 --- a/comp/process/agent/agentimpl/agent_linux_test.go +++ b/comp/process/agent/agentimpl/agent_linux_test.go @@ -17,6 +17,9 @@ import ( "go.uber.org/fx" configComp "github.com/DataDog/datadog-agent/comp/core/config" + log "github.com/DataDog/datadog-agent/comp/core/log/def" + logmock "github.com/DataDog/datadog-agent/comp/core/log/mock" + "github.com/DataDog/datadog-agent/comp/core/sysprobeconfig/sysprobeconfigimpl" taggerMock "github.com/DataDog/datadog-agent/comp/core/tagger/mock" "github.com/DataDog/datadog-agent/comp/core/telemetry" "github.com/DataDog/datadog-agent/comp/core/telemetry/telemetryimpl" @@ -129,6 +132,9 @@ func TestProcessAgentComponentOnLinux(t *testing.T) { submitterimpl.MockModule(), taggerMock.Module(), statsd.MockModule(), + fx.Provide(func(t testing.TB) log.Component { return logmock.New(t) }), + configComp.MockModule(), + sysprobeconfigimpl.MockModule(), Module(), fx.Replace(configComp.MockParams{Overrides: map[string]interface{}{ @@ -197,6 +203,9 @@ func TestStatusProvider(t *testing.T) { "process_config.run_in_core_agent.enabled": true, }}), processcheckimpl.MockModule(), + fx.Provide(func(t testing.TB) log.Component { return logmock.New(t) }), + configComp.MockModule(), + sysprobeconfigimpl.MockModule(), fx.Provide(func() func(c *checkMocks.Check) { return func(c *checkMocks.Check) { c.On("Init", mock.Anything, mock.Anything, mock.AnythingOfType("bool")).Return(nil).Maybe() @@ -242,6 +251,9 @@ func TestTelemetryCoreAgent(t *testing.T) { "telemetry.enabled": true, }}), processcheckimpl.MockModule(), + fx.Provide(func(t testing.TB) log.Component { return logmock.New(t) }), + configComp.MockModule(), + sysprobeconfigimpl.MockModule(), fx.Provide(func() func(c *checkMocks.Check) { return func(c *checkMocks.Check) { c.On("Init", mock.Anything, mock.Anything, mock.AnythingOfType("bool")).Return(nil).Maybe() diff --git a/comp/process/agent/agentimpl/agent_test.go b/comp/process/agent/agentimpl/agent_test.go index 5f361759772229..c5578328202fc7 100644 --- a/comp/process/agent/agentimpl/agent_test.go +++ b/comp/process/agent/agentimpl/agent_test.go @@ -13,6 +13,10 @@ import ( "github.com/stretchr/testify/assert" "go.uber.org/fx" + "github.com/DataDog/datadog-agent/comp/core/config" + log "github.com/DataDog/datadog-agent/comp/core/log/def" + logmock "github.com/DataDog/datadog-agent/comp/core/log/mock" + "github.com/DataDog/datadog-agent/comp/core/sysprobeconfig/sysprobeconfigimpl" taggermock "github.com/DataDog/datadog-agent/comp/core/tagger/mock" "github.com/DataDog/datadog-agent/comp/dogstatsd/statsd" "github.com/DataDog/datadog-agent/comp/process/agent" @@ -66,6 +70,9 @@ func TestProcessAgentComponent(t *testing.T) { taggermock.Module(), statsd.MockModule(), Module(), + fx.Provide(func(t testing.TB) log.Component { return logmock.New(t) }), + config.MockModule(), + sysprobeconfigimpl.MockModule(), } if tc.checksEnabled {