@@ -138,15 +138,18 @@ func TestHostProfilerLoggingSeccomp(t *testing.T) {
138138 overrides := copyMap (hostProfilerBaseOverrides )
139139 overrides ["datadog.hostProfiler.loggingSeccomp" ] = "true"
140140 ds := renderHostProfilerDaemonSet (t , overrides )
141+
141142 initContainer , ok := getContainer (t , ds .Spec .Template .Spec .InitContainers , "host-profiler-seccomp-setup" )
142143 require .True (t , ok )
143-
144- // Prefer the logging profile, falling back to the default if the image predates it.
145144 cmd := strings .Join (initContainer .Command , " " )
146- assert .Contains (t , cmd , "if [ -f /etc/dd-host-profiler/logging-seccomp.json ]" ,
147- "init container should guard the logging profile copy; command: %v" , initContainer .Command )
148145 assert .Contains (t , cmd , "cp /etc/dd-host-profiler/logging-seccomp.json" )
149- assert .Contains (t , cmd , "cp /etc/dd-host-profiler/seccomp.json" , "should fall back to the default profile" )
146+ assert .Contains (t , cmd , "cp /etc/dd-host-profiler/seccomp.json" )
147+ assert .Contains (t , cmd , "WARNING: logging-seccomp.json not found in image, falling back to default seccomp profile" )
148+
149+ hpContainer , ok := getContainer (t , ds .Spec .Template .Spec .Containers , "host-profiler" )
150+ require .True (t , ok )
151+ require .NotNil (t , hpContainer .SecurityContext .SeccompProfile )
152+ assert .Regexp (t , `^host-profiler-[0-9a-f]{8}-logging$` , * hpContainer .SecurityContext .SeccompProfile .LocalhostProfile )
150153}
151154
152155func containsString (slice []string , s string ) bool {
0 commit comments