mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 10:25:28 +00:00
Test installation of NetworkManager plugins
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
This commit is contained in:
parent
f4fabea554
commit
fb5d6218de
6 changed files with 124 additions and 0 deletions
|
|
@ -17,3 +17,7 @@ extends: yamllint_defaults.yml
|
|||
# line-length: disable
|
||||
rules:
|
||||
truthy: disable
|
||||
line-length:
|
||||
ignore: |
|
||||
/tests/tests_wireless_plugin_installation_nm.yml
|
||||
/tests/tests_team_plugin_installation_nm.yml
|
||||
|
|
|
|||
|
|
@ -83,11 +83,13 @@ NM_ONLY_TESTS = {
|
|||
"playbooks/tests_team.yml": {
|
||||
EXTRA_RUN_CONDITION: "ansible_distribution != 'Fedora'",
|
||||
},
|
||||
"playbooks/tests_team_plugin_installation.yml": {},
|
||||
# mac80211_hwsim (used for tests_wireless) only seems to be available
|
||||
# and working on RHEL/CentOS 7
|
||||
"playbooks/tests_wireless.yml": {
|
||||
EXTRA_RUN_CONDITION: "ansible_distribution_major_version == '7'",
|
||||
},
|
||||
"playbooks/tests_wireless_plugin_installation.yml": {},
|
||||
}
|
||||
|
||||
IGNORE = [
|
||||
|
|
|
|||
40
tests/playbooks/tests_team_plugin_installation.yml
Normal file
40
tests/playbooks/tests_team_plugin_installation.yml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: remove the NetworkManager-team package
|
||||
package:
|
||||
name: "NetworkManager-team"
|
||||
state: absent
|
||||
|
||||
- name: "get the rpm package facts"
|
||||
package_facts:
|
||||
manager: "auto"
|
||||
|
||||
- name: "Assert NetworkManager-team removed before team configuration"
|
||||
assert:
|
||||
that:
|
||||
- "'NetworkManager-team' not in ansible_facts.packages"
|
||||
msg: "NetworkManager-team is not removed before team configuration"
|
||||
|
||||
- name: "Team interface configuration"
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
# Specify the team profile
|
||||
- name: team0
|
||||
persistent_state: present
|
||||
type: team
|
||||
interface_name: team0
|
||||
|
||||
- name: "get the rpm package facts"
|
||||
package_facts:
|
||||
manager: "auto"
|
||||
|
||||
- name: "Assert NetworkManager-team is installed after team configuration"
|
||||
assert:
|
||||
that:
|
||||
- "'NetworkManager-team' in ansible_facts.packages"
|
||||
msg: "NetworkManager-team is not installed after team configuration"
|
||||
...
|
||||
40
tests/playbooks/tests_wireless_plugin_installation.yml
Normal file
40
tests/playbooks/tests_wireless_plugin_installation.yml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: remove the NetworkManager-wifi package
|
||||
package:
|
||||
name: "NetworkManager-wifi"
|
||||
state: absent
|
||||
|
||||
- name: "get the rpm package facts"
|
||||
package_facts:
|
||||
manager: "auto"
|
||||
|
||||
- name: "Assert NetworkManager-wifi removed before wireless configuration"
|
||||
assert:
|
||||
that:
|
||||
- "'NetworkManager-wifi' not in ansible_facts.packages"
|
||||
msg: "NetworkManager-wifi is not removed before wirelss configuration"
|
||||
|
||||
- name: "wireless configuration"
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
- name: wlan0
|
||||
type: wireless
|
||||
wireless:
|
||||
ssid: "My WPA2-PSK Network"
|
||||
key_mgmt: "wpa-psk"
|
||||
password: "p@55w0rD"
|
||||
|
||||
- name: "get the rpm package facts"
|
||||
package_facts:
|
||||
manager: "auto"
|
||||
|
||||
- name: "Assert NetworkManager-wifi installed after wireless configuration"
|
||||
assert:
|
||||
that:
|
||||
- "'NetworkManager-wifi' in ansible_facts.packages"
|
||||
msg: "NetworkManager-wifi is not installed after wireless configured"
|
||||
19
tests/tests_team_plugin_installation_nm.yml
Normal file
19
tests/tests_team_plugin_installation_nm.yml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# This file was generated by ensure_provider_tests.py
|
||||
---
|
||||
# set network provider and gather facts
|
||||
- hosts: all
|
||||
name: Run playbook 'playbooks/tests_team_plugin_installation.yml' with nm as provider
|
||||
tasks:
|
||||
- name: Set network provider to 'nm'
|
||||
set_fact:
|
||||
network_provider: nm
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
# The test requires or should run with NetworkManager, therefore it cannot run
|
||||
# on RHEL/CentOS 6
|
||||
- import_playbook: playbooks/tests_team_plugin_installation.yml
|
||||
when:
|
||||
- ansible_distribution_major_version != '6'
|
||||
19
tests/tests_wireless_plugin_installation_nm.yml
Normal file
19
tests/tests_wireless_plugin_installation_nm.yml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# This file was generated by ensure_provider_tests.py
|
||||
---
|
||||
# set network provider and gather facts
|
||||
- hosts: all
|
||||
name: Run playbook 'playbooks/tests_wireless_plugin_installation.yml' with nm as provider
|
||||
tasks:
|
||||
- name: Set network provider to 'nm'
|
||||
set_fact:
|
||||
network_provider: nm
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
# The test requires or should run with NetworkManager, therefore it cannot run
|
||||
# on RHEL/CentOS 6
|
||||
- import_playbook: playbooks/tests_wireless_plugin_installation.yml
|
||||
when:
|
||||
- ansible_distribution_major_version != '6'
|
||||
Loading…
Add table
Add a link
Reference in a new issue