Skip to content

Commit

Permalink
fix flare tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brycekahle committed Jan 31, 2025
1 parent d2d826c commit 0bdada9
Showing 3 changed files with 10 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/agent/subcommands/flare/command.go
Original file line number Diff line number Diff line change
@@ -242,13 +242,15 @@ func readProfileData(seconds int) (flare.ProfileData, error) {
"security-agent": serviceProfileCollector(tcpGet("security_agent.expvar_port", false), seconds),
}

if !pkgconfigsetup.Datadog().GetBool("process_config.run_in_core_agent.enabled") {
if pkgconfigsetup.Datadog().GetBool("process_config.enabled") ||
processChecksInProcessAgent := !pkgconfigsetup.Datadog().GetBool("process_config.run_in_core_agent.enabled") &&
(pkgconfigsetup.Datadog().GetBool("process_config.enabled") ||
pkgconfigsetup.Datadog().GetBool("process_config.container_collection.enabled") ||
pkgconfigsetup.Datadog().GetBool("process_config.process_collection.enabled") {
pkgconfigsetup.Datadog().GetBool("process_config.process_collection.enabled"))
npmEnabled := pkgconfigsetup.SystemProbe().GetBool("network_config.enabled")
usmEnabled := pkgconfigsetup.SystemProbe().GetBool("service_monitoring_config.enabled")

agentCollectors["process"] = serviceProfileCollector(tcpGet("process_config.expvar_port", false), seconds)
}
if processChecksInProcessAgent || npmEnabled || usmEnabled {
agentCollectors["process"] = serviceProfileCollector(tcpGet("process_config.expvar_port", false), seconds)
}

if pkgconfigsetup.Datadog().GetBool("apm_config.enabled") {
1 change: 1 addition & 0 deletions cmd/agent/subcommands/flare/command_other_test.go
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ func NewSystemProbeTestServer(_ http.Handler) (*httptest.Server, error) {
func InjectConnectionFailures(mockSysProbeConfig model.Config, _ model.Config) {
mockSysProbeConfig.SetWithoutSource("system_probe_config.enabled", true)
mockSysProbeConfig.SetWithoutSource("system_probe_config.sysprobe_socket", "/opt/datadog-agent/run/sysprobe-bad.sock")
mockSysProbeConfig.SetWithoutSource("network_config.enabled", true)
}

// CheckExpectedConnectionFailures checks the expected errors after simulated
2 changes: 2 additions & 0 deletions cmd/agent/subcommands/flare/command_test.go
Original file line number Diff line number Diff line change
@@ -138,6 +138,7 @@ func (c *commandTestSuite) TestReadProfileData() {
mockSysProbeConfig := configmock.NewSystemProbe(t)
mockSysProbeConfig.SetWithoutSource("system_probe_config.enabled", true)
mockSysProbeConfig.SetWithoutSource("system_probe_config.sysprobe_socket", c.sysprobeSocketPath)
mockSysProbeConfig.SetWithoutSource("network_config.enabled", true)
}

data, err := readProfileData(10)
@@ -205,6 +206,7 @@ func (c *commandTestSuite) TestReadProfileDataNoTraceAgent() {
mockSysProbeConfig := configmock.NewSystemProbe(t)
mockSysProbeConfig.SetWithoutSource("system_probe_config.enabled", true)
mockSysProbeConfig.SetWithoutSource("system_probe_config.sysprobe_socket", c.sysprobeSocketPath)
mockSysProbeConfig.SetWithoutSource("network_config.enabled", true)

data, err := readProfileData(10)
require.Error(t, err)

0 comments on commit 0bdada9

Please sign in to comment.