Skip to content

Commit 7aa9739

Browse files
committed
test: ensure NetworkManager is installed and running for mac match test
This is mainly needed on el7 - NetworkManager is installed by default, or somewhere else, on el8 and later. Signed-off-by: Rich Megginson <[email protected]>
1 parent 6acd803 commit 7aa9739

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

tests/ensure_provider_tests.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@
8080
"playbooks/tests_infiniband.yml": {},
8181
"playbooks/tests_ipv6_disabled.yml": {},
8282
"playbooks/tests_ipv6_dns_search.yml": {},
83-
"playbooks/tests_mac_address_match.yml": {},
83+
"playbooks/tests_mac_address_match.yml": {
84+
MINIMUM_VERSION: "'1.18.0'",
85+
"comment": "# needs any old version of NM",
86+
},
8487
"playbooks/tests_provider.yml": {
8588
MINIMUM_VERSION: "'1.20.0'",
8689
"comment": "# NetworKmanager 1.20.0 added support for forgetting profiles",

tests/playbooks/tests_mac_address_match.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
tags:
3434
- always
3535

36+
- name: Ensure NetworkManager is running
37+
service:
38+
name: NetworkManager
39+
state: started
40+
3641
- name: Install ethtool (test dependency)
3742
package:
3843
name: ethtool

tests/tests_mac_address_match_nm.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,32 @@
1414
tags:
1515
- always
1616

17+
- name: Install NetworkManager and get NetworkManager version
18+
when:
19+
- ansible_distribution_major_version != '6'
20+
tags:
21+
- always
22+
block:
23+
- name: Install NetworkManager
24+
package:
25+
name: NetworkManager
26+
state: present
27+
use: "{{ (__network_is_ostree | d(false)) |
28+
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
29+
- name: Get package info
30+
package_facts:
31+
- name: Get NetworkManager version
32+
set_fact:
33+
networkmanager_version: "{{
34+
ansible_facts.packages['NetworkManager'][0]['version'] }}"
35+
1736

1837
# The test requires or should run with NetworkManager, therefore it cannot run
1938
# on RHEL/CentOS 6
39+
# needs any old version of NM
2040
- name: Import the playbook 'playbooks/tests_mac_address_match.yml'
2141
import_playbook: playbooks/tests_mac_address_match.yml
2242
when:
2343
- ansible_distribution_major_version != '6'
44+
45+
- networkmanager_version is version('1.18.0', '>=')

0 commit comments

Comments
 (0)