Skip to content

Commit ad79729

Browse files
committed
add test for login-only nodes when using --limit
1 parent 826eccc commit ad79729

File tree

5 files changed

+135
-0
lines changed

5 files changed

+135
-0
lines changed

molecule/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ test5 | 1 | N | As for #1 but configless
1616
test6 | 1 | N | 0x compute nodes, configless
1717
test7 | 1 | N | 1x compute node, no login node, configless
1818
test8 | 1 | N | 2x compute node, 2x login-only nodes, configless
19+
test9 | 1 | N | As test8 but uses `--limit=testohpc-control,testohpc-compute-0` and checks login nodes still end up in slurm.conf
1920

2021
# Local Installation & Running
2122

molecule/test9/INSTALL.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
*******
2+
Docker driver installation guide
3+
*******
4+
5+
Requirements
6+
============
7+
8+
* Docker Engine
9+
10+
Install
11+
=======
12+
13+
Please refer to the `Virtual environment`_ documentation for installation best
14+
practices. If not using a virtual environment, please consider passing the
15+
widely recommended `'--user' flag`_ when invoking ``pip``.
16+
17+
.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
18+
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site
19+
20+
.. code-block:: bash
21+
22+
$ python3 -m pip install 'molecule[docker]'

molecule/test9/converge.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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_control'] }}"
11+
batch: "{{ inventory_hostname in groups['testohpc_compute'] }}"
12+
login: "{{ inventory_hostname in groups['testohpc_login'] }}"
13+
runtime: true
14+
openhpc_slurm_control_host: "{{ groups['testohpc_control'] | first }}"
15+
openhpc_slurm_partitions:
16+
- name: "compute"
17+
openhpc_cluster_name: testohpc
18+
openhpc_slurm_configless: true
19+
openhpc_login_only_nodes: 'testohpc_login'
20+

molecule/test9/molecule.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
name: single partition, group is partition
3+
driver:
4+
name: docker
5+
platforms:
6+
- name: testohpc-control
7+
image: ${MOLECULE_IMAGE}
8+
pre_build_image: true
9+
groups:
10+
- testohpc_control
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+
20+
- name: testohpc-login-0
21+
image: ${MOLECULE_IMAGE}
22+
pre_build_image: true
23+
groups:
24+
- testohpc_login
25+
command: /sbin/init
26+
tmpfs:
27+
- /run
28+
- /tmp
29+
volumes:
30+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
31+
networks:
32+
- name: net1
33+
34+
- name: testohpc-login-1
35+
image: ${MOLECULE_IMAGE}
36+
pre_build_image: true
37+
groups:
38+
- testohpc_login
39+
command: /sbin/init
40+
tmpfs:
41+
- /run
42+
- /tmp
43+
volumes:
44+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
45+
networks:
46+
- name: net1
47+
48+
- name: testohpc-compute-0
49+
image: ${MOLECULE_IMAGE}
50+
pre_build_image: true
51+
groups:
52+
- testohpc_compute
53+
command: /sbin/init
54+
tmpfs:
55+
- /run
56+
- /tmp
57+
volumes:
58+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
59+
networks:
60+
- name: net1
61+
- name: testohpc-compute-1
62+
image: ${MOLECULE_IMAGE}
63+
pre_build_image: true
64+
groups:
65+
- testohpc_compute
66+
command: /sbin/init
67+
tmpfs:
68+
- /run
69+
- /tmp
70+
volumes:
71+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
72+
networks:
73+
- name: net1
74+
provisioner:
75+
name: ansible
76+
ansible_args:
77+
- --limit=testohpc-control,testohpc-compute-0
78+
verifier:
79+
name: ansible

molecule/test9/verify.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
3+
- hosts: testohpc_control
4+
tasks:
5+
- name: Check both compute nodes are listed and compute-0 is up
6+
shell: 'sinfo --noheader --Node --format="%P,%a,%l,%D,%t,%N"' # using --format ensures we control whitespace
7+
register: sinfo
8+
- assert: # PARTITION AVAIL TIMELIMIT NODES STATE NODELIST
9+
that: "sinfo.stdout_lines == ['compute*,up,60-00:00:00,1,idle,testohpc-compute-0','compute*,up,60-00:00:00,1,unk*,testohpc-compute-1']" # NB: -1 goes 'down' after a while!
10+
fail_msg: "FAILED - actual value: {{ sinfo.stdout_lines }}"
11+
- name: Check login nodes in config
12+
command: "grep NodeName={{ item }} /etc/slurm/slurm.conf"
13+
loop: "{{ groups['testohpc_login'] }}"

0 commit comments

Comments
 (0)