Testsuite - Add test case in test_116_9 about overcommit cpus-per-task Verify srun -N1 -n2 -c1 -O completes on a one-CPU node instead of remaining pending with Reason Resources. The case is added to the canonical overcommit test (test_116_9) rather than a separate file, and the redundant test_116_59 is removed. Ticket: 25536
diff --git a/testsuite/python/tests/test_116_9.py b/testsuite/python/tests/test_116_9.py index 4113604..61ca779 100644 --- a/testsuite/python/tests/test_116_9.py +++ b/testsuite/python/tests/test_116_9.py
@@ -37,3 +37,32 @@ assert ( re.search(rf"srun: ntasks\s+: {cpu_count + 1}", results["stderr"]) is not None ) + + +@pytest.mark.skipif( + atf.get_version("sbin/slurmctld") < (26, 11), + reason="Ticket 25536: overcommit with cpus-per-task placement fix", +) +def test_overcommit_cpus_per_task(): + """Verify srun -n2 -c1 --overcommit runs on a one-CPU node. + + Ticket 25536: -cN sets tres_per_task=cpu=N; a cpu-only tres_per_task + must keep the overcommit placement path instead of leaving the job + pending with Reason Resources. + """ + # Pin to a one-CPU node so -n2 cannot fit without overcommit. + eligible_node = None + for node in atf.nodes: + if "IDLE" in atf.nodes[node]["state"] and atf.nodes[node]["cpus"] == 1: + eligible_node = node + break + if eligible_node is None: + pytest.skip("This test requires one idle node with exactly 1 CPU") + + results = atf.run_command( + f"srun -N1 -w {eligible_node} -n2 -c1 --overcommit -t1 -v /bin/true", + fatal=True, + ) + assert ( + re.search(r"srun: ntasks\s+: 2", results["stderr"]) is not None + ), "srun should launch 2 tasks on the one-CPU node with overcommit"