@@ -16,17 +16,43 @@ import (
1616 "github.com/stretchr/testify/require"
1717)
1818
19- func TestWritePARExecutorProcmgrConfig (t * testing.T ) {
19+ // Fleet policies follow the supervising unit's config dir, so an experiment
20+ // reads the experiment tree rather than stable.
21+ const fleetPoliciesDirSetting = "DD_FLEET_POLICIES_DIR: ${DD_CONF_DIR}/managed/datadog-agent/stable"
22+
23+ func TestWritePARProcmgrConfigs (t * testing.T ) {
2024 installRoot := t .TempDir ()
21- configPath := filepath . Join ( installRoot , "processes.d" , parExecutorProcmgrConfigName )
25+ require . NoError ( t , writePARProcmgrConfigs ( installRoot ) )
2226
23- require .NoError (t , writePARExecutorProcmgrConfig (installRoot ))
24- content , err := os .ReadFile (configPath )
25- require .NoError (t , err )
27+ executor := readProcmgrConfig (t , installRoot , parExecutorProcmgrConfigName )
28+ assert .Contains (t , executor , "${DD_CONF_DIR}/datadog.yaml" )
29+ assert .Contains (t , executor , filepath .Join (installRoot , "embedded" , "bin" , "privateactionrunner" ))
30+ // Only par-control starts the executor, and procmgr must not resurrect it.
31+ assert .Contains (t , executor , "auto_start: false" )
32+ assert .Contains (t , executor , "restart: never" )
33+ assert .Contains (t , executor , fleetPoliciesDirSetting )
34+ assert .NotContains (t , executor , "/opt/datadog-agent/" )
2635
27- assert .Contains (t , string (content ), "${DD_CONF_DIR}/datadog.yaml" )
28- assert .Contains (t , string (content ), filepath .Join (installRoot , "embedded" , "bin" , "privateactionrunner" ))
29- assert .Contains (t , string (content ), "auto_start: false" )
30- assert .Contains (t , string (content ), "restart: never" )
31- assert .NotContains (t , string (content ), "/opt/datadog-agent/" )
36+ control := readProcmgrConfig (t , installRoot , parControlProcmgrConfigName )
37+ assert .Contains (t , control , "${DD_CONF_DIR}/datadog.yaml" )
38+ assert .Contains (t , control , filepath .Join (installRoot , "embedded" , "bin" , "par-control" ))
39+ // Rust resolves operational configuration directly; Go remains responsible
40+ // only for the hostname-aware enrollment bootstrap.
41+ assert .NotContains (t , control , "--config-helper" )
42+ assert .Contains (t , control , "--ensure-enrollment-command" )
43+ assert .Contains (t , control , filepath .Join (installRoot , "embedded" , "bin" , "privateactionrunner" ))
44+ assert .Contains (t , control , fleetPoliciesDirSetting )
45+ // The control plane is always on: procmgr starts it with the Agent and restarts
46+ // it on crash. on-failure ignores the clean exit taken when split mode is off.
47+ assert .Contains (t , control , "auto_start: true" )
48+ assert .Contains (t , control , "stop_timeout: 180" )
49+ assert .Contains (t , control , "restart: on-failure" )
50+ assert .NotContains (t , control , "/opt/datadog-agent/" )
51+ }
52+
53+ func readProcmgrConfig (t * testing.T , installRoot , name string ) string {
54+ t .Helper ()
55+ content , err := os .ReadFile (filepath .Join (installRoot , "processes.d" , name ))
56+ require .NoError (t , err )
57+ return string (content )
3258}
0 commit comments