Skip to content

Commit 5c73660

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 <rmeggins@redhat.com>
1 parent 6acd803 commit 5c73660

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

tests/ensure_provider_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@
9595
MINIMUM_VERSION: "'1.26.0'",
9696
"comment": "# NetworkManager 1.26.0 added support for match.path setting",
9797
},
98+
"playbooks/tests_mac_address_match.yml": {
99+
MINIMUM_VERSION: "'1.18.0'",
100+
"comment": "# needs any old version of NM",
101+
},
98102
"playbooks/tests_network_state.yml": {
99103
EXTRA_RUN_CONDITION: "ansible_distribution_major_version | int > 7",
100104
},

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)