File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -222,6 +222,7 @@ def test_container(
222222@pytest .fixture
223223def docker_selinux_xattr (
224224 docker_client : docker .DockerClient ,
225+ monitored_dir : str ,
225226 test_file : str ,
226227) -> list [Event ]:
227228 """
@@ -231,6 +232,8 @@ def docker_selinux_xattr(
231232 relabels files with security.selinux. This fixture returns the
232233 expected events if Docker has SELinux enabled, or an empty list
233234 otherwise.
235+
236+ Docker relabels both the file and its parent directory.
234237 """
235238 info = docker_client .info ()
236239 selinux = any ('selinux' in opt for opt in info .get ('SecurityOptions' , []))
@@ -247,6 +250,13 @@ def docker_selinux_xattr(
247250 host_path = test_file ,
248251 xattr_name = 'security.selinux' ,
249252 ),
253+ Event (
254+ process = dockerd ,
255+ event_type = EventType .XATTR_SET ,
256+ file = '' ,
257+ host_path = monitored_dir ,
258+ xattr_name = 'security.selinux' ,
259+ ),
250260 ]
251261
252262
You can’t perform that action at this time.
0 commit comments