Skip to content

Commit fcdc630

Browse files
committed
add tests for node removal
1 parent 4fa0ec8 commit fcdc630

File tree

4 files changed

+114
-1
lines changed

4 files changed

+114
-1
lines changed

molecule/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ test3 | 1 | Y | -
1414
test4 | 1 | N | 2x compute node, accounting enabled
1515
test5 | 1 | N | As for #1 but configless
1616
test6 | 1 | N | 0x compute nodes, configless
17-
test7 | 1 | N | 1x compute node, no login node, configless
17+
test7 | 1 | N | 1x compute node, no login node, configless (checks image build should work)
1818
test8 | 1 | N | 2x compute node, 2x login-only nodes, configless
1919
test9 | 1 | N | As test8 but uses `--limit=testohpc-control,testohpc-compute-0` and checks login nodes still end up in slurm.conf
2020
test10 | 1 | N | As for #5 but then tries to add an additional node
21+
test11 | 1 | N | As for #5 but then deletes a node (actually changes the partition due to molecule/ansible limitations)
2122

2223
# Local Installation & Running
2324

molecule/test11/converge.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
- name: Converge
3+
hosts: all
4+
tasks:
5+
- name: "Include ansible-role-openhpc"
6+
include_role:
7+
name: "ansible-role-openhpc/"
8+
vars:
9+
openhpc_enable:
10+
control: "{{ inventory_hostname in groups['testohpc_login'] }}"
11+
batch: "{{ inventory_hostname in groups['testohpc_compute'] }}"
12+
runtime: true
13+
openhpc_slurm_control_host: "{{ groups['testohpc_login'] | first }}"
14+
openhpc_slurm_partitions:
15+
- name: "compute_orig"
16+
openhpc_cluster_name: testohpc
17+
openhpc_slurm_configless: true

molecule/test11/molecule.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: single partition, group is partition
3+
driver:
4+
name: docker
5+
platforms:
6+
- name: testohpc-login-0
7+
image: ${MOLECULE_IMAGE}
8+
pre_build_image: true
9+
groups:
10+
- testohpc_login
11+
command: /sbin/init
12+
tmpfs:
13+
- /run
14+
- /tmp
15+
volumes:
16+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
17+
networks:
18+
- name: net1
19+
- name: testohpc-compute-0
20+
image: ${MOLECULE_IMAGE}
21+
pre_build_image: true
22+
groups:
23+
- testohpc_compute
24+
- testohpc_compute_orig
25+
- testohpc_compute_new
26+
command: /sbin/init
27+
tmpfs:
28+
- /run
29+
- /tmp
30+
volumes:
31+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
32+
networks:
33+
- name: net1
34+
- name: testohpc-compute-1
35+
image: ${MOLECULE_IMAGE}
36+
pre_build_image: true
37+
groups:
38+
- testohpc_compute
39+
- testohpc_compute_orig
40+
command: /sbin/init
41+
tmpfs:
42+
- /run
43+
- /tmp
44+
volumes:
45+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
46+
networks:
47+
- name: net1
48+
provisioner:
49+
name: ansible
50+
verifier:
51+
name: ansible

molecule/test11/verify.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
3+
- name: Check initial cluster has 2x nodes
4+
hosts: testohpc_login
5+
tasks:
6+
- name: Get slurm partition info
7+
command: sinfo --noheader --format="%P,%a,%l,%D,%t,%N" # using --format ensures we control whitespace
8+
register: sinfo
9+
changed_when: false
10+
- assert: # PARTITION AVAIL TIMELIMIT NODES STATE NODELIST
11+
that: "sinfo.stdout_lines == ['compute_orig*,up,60-00:00:00,2,idle,testohpc-compute-[0-1]']"
12+
fail_msg: "FAILED - actual value: {{ sinfo.stdout_lines }}"
13+
success_msg: "OK - 2x nodes idle"
14+
15+
- name: Rerun with smaller compute group
16+
hosts:
17+
- testohpc_login
18+
- testohpc_compute_new
19+
tasks:
20+
- name: "Include ansible-role-openhpc"
21+
include_role:
22+
name: "ansible-role-openhpc/"
23+
vars:
24+
openhpc_enable:
25+
control: "{{ inventory_hostname in groups['testohpc_login'] }}"
26+
batch: "{{ inventory_hostname in groups['testohpc_compute'] }}"
27+
runtime: true
28+
openhpc_slurm_control_host: "{{ groups['testohpc_login'] | first }}"
29+
openhpc_slurm_partitions:
30+
- name: "compute_new"
31+
openhpc_cluster_name: testohpc
32+
openhpc_slurm_configless: true
33+
34+
- name: Check modified cluster has 1x nodes
35+
hosts: testohpc_login
36+
tasks:
37+
- name: Get slurm partition info
38+
command: sinfo --noheader --format="%P,%a,%l,%D,%t,%N" # using --format ensures we control whitespace
39+
register: sinfo
40+
changed_when: false
41+
- assert: # PARTITION AVAIL TIMELIMIT NODES STATE NODELIST
42+
that: "sinfo.stdout_lines == ['compute_new*,up,60-00:00:00,1,idle,testohpc-compute-0']"
43+
fail_msg: "FAILED - actual value: {{ sinfo.stdout_lines }}"
44+
success_msg: "OK - 1x nodes idle"

0 commit comments

Comments
 (0)