Skip to content

Commit

Permalink
WIP: Passes, but ONLY when sleep is 0.1, longer periods result in too…
Browse files Browse the repository at this point in the history
… many PIDs??
  • Loading branch information
asmacdo committed Jan 14, 2025
1 parent fa434d8 commit 46b8a5a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions test/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
from pathlib import Path
import subprocess
import pytest

ABANDONING_PARENT = str(Path(__file__).with_name("data") / "abandoning_parent.sh")

Expand All @@ -11,9 +12,9 @@ def test_sanity(temp_output_dir: str) -> None:
subprocess.check_output(command, shell=True)


def test_abandoning_parent(temp_output_dir: str) -> None:
@pytest.mark.parametrize("num_children", [3, 5, 10, 20])
def test_abandoning_parent(temp_output_dir: str, num_children: int) -> None:
duct_prefix = f"{temp_output_dir}log_"
num_children = 3
command = f"duct -p {duct_prefix} {ABANDONING_PARENT} {num_children} sleep 0.1"
subprocess.check_output(command, shell=True)

Expand All @@ -25,5 +26,12 @@ def test_abandoning_parent(temp_output_dir: str) -> None:
if len(max_processes_sample) < len(sample.get("processes")):
max_processes_sample = sample

cmds = [proc["cmd"] for _pid, proc in max_processes_sample["processes"].items()]

# DEBUG
from pprint import pprint

pprint(cmds)

# 1 for each child, 1 for pstree, 1 for parent
assert len(max_processes_sample) == num_children + 2
assert len(max_processes_sample["processes"]) == num_children + 2

0 comments on commit 46b8a5a

Please sign in to comment.