Skip to content

Commit 61bfb95

Browse files
committed
test cgroup enabled
1 parent 89b2930 commit 61bfb95

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

molecule/test1/verify.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,30 @@
66
- name: Get slurm partition info
77
command: sinfo --noheader --format="%P,%a,%l,%D,%t,%N" # using --format ensures we control whitespace
88
register: sinfo
9-
- name:
9+
- name:
1010
assert: # PARTITION AVAIL TIMELIMIT NODES STATE NODELIST
1111
that: "sinfo.stdout_lines == ['compute*,up,60-00:00:00,2,idle,testohpc-compute-[0-1]']"
1212
fail_msg: "FAILED - actual value: {{ sinfo.stdout_lines }}"
13+
14+
- name: Run limited job
15+
hosts: testohpc_login
16+
tasks:
17+
- shell: printf '#!bin/bash\nsleep 500' | sbatch --cpus-per-task=1 --ntasks=1 --mem=200m --nodelist=testohpc-compute-0
18+
19+
- name: Check cgroup limits on jobs
20+
hosts: testohpc-compute-0
21+
tasks:
22+
- name: Get cpuset cgroup limit
23+
shell: cat /sys/fs/cgroup/system.slice/testohpc-compute-0_slurmstepd.scope/job_*/cpuset.cpus
24+
register: job_cpuset
25+
- name: Assert cpuset cgroup presence
26+
assert:
27+
that: "job_cpuset.stdout_lines[0] in ('0', '0-1')" # depending on the VM's state
28+
fail_msg: "FAILED - actual value: {{ job_cpuset.stdout_lines }}"
29+
- name: Get memory cgroup limit
30+
shell: cat /sys/fs/cgroup/system.slice/testohpc-compute-0_slurmstepd.scope/job_*/memory.max
31+
register: job_memory
32+
- name: Assert memory cgroup limit
33+
assert:
34+
that: "job_memory.stdout_lines == ['209715200']"
35+
fail_msg: "FAILED - actual value: {{ job_memory.stdout_lines }}"

0 commit comments

Comments
 (0)