seaworthy.ps¶
Tools for asserting on processes running in containers using ps
.
-
build_process_tree
(ps_rows)[source]¶ Build a tree structure from a list of PsRow objects. :param ps_rows: a list of PsRow objects :return: a PsTree object
-
list_container_processes
(container)[source]¶ List the processes running inside a container. We use an exec rather than container.top() because we want to run ‘ps’ inside the container. This is because we want to get PIDs and usernames in the container’s namespaces. container.top() uses ‘ps’ from outside the container in the host’s namespaces. Note that this requires the container to have a ‘ps’ that responds to the arguments we give it– we use BusyBox’s (Alpine’s) ‘ps’ as a baseline for available functionality. :param container: the container to query :return: a list of PsRow objects