Update roles
This commit is contained in:
@@ -4,46 +4,134 @@
|
||||
vars:
|
||||
interface: statebr
|
||||
profile: "{{ interface }}"
|
||||
network_provider: nm
|
||||
lsr_fail_debug:
|
||||
- __network_connections_result
|
||||
tasks:
|
||||
- debug:
|
||||
msg: Inside states tests
|
||||
- include_tasks: tasks/show-interfaces.yml
|
||||
- include_tasks: tasks/assert-device_absent.yml
|
||||
msg: "this is: playbooks/tests_states.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
# create test profile
|
||||
- include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
- name: statebr
|
||||
state: up
|
||||
type: bridge
|
||||
ip:
|
||||
dhcp4: false
|
||||
auto6: false
|
||||
- include_tasks: tasks/assert-device_present.yml
|
||||
- include_tasks: tasks/assert-profile_present.yml
|
||||
|
||||
# test case (remove profile but keep it up)
|
||||
# I can remove a profile but keep the configuration active.
|
||||
- include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
- name: statebr
|
||||
persistent_state: absent
|
||||
- include_tasks: tasks/assert-device_present.yml
|
||||
- include_tasks: tasks/assert-profile_absent.yml
|
||||
- block:
|
||||
- include_tasks: tasks/run_test.yml
|
||||
vars:
|
||||
lsr_description: I can create a profile
|
||||
lsr_setup:
|
||||
- tasks/delete_interface.yml
|
||||
- tasks/assert_device_absent.yml
|
||||
lsr_test:
|
||||
- tasks/create_bridge_profile.yml
|
||||
lsr_assert:
|
||||
- tasks/assert_profile_present.yml
|
||||
lsr_assert_when:
|
||||
# Device should be present because of autoconnect: true by
|
||||
# default for NM (this might be considered a bug)
|
||||
- what: tasks/assert_device_present.yml
|
||||
when: "{{ network_provider == 'nm' }}"
|
||||
lsr_cleanup:
|
||||
- tasks/cleanup_profile+device.yml
|
||||
tags:
|
||||
- tests::states:create
|
||||
|
||||
# test case
|
||||
# I can set a profile down that is up and absent.
|
||||
- name: Set down
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
- name: statebr
|
||||
state: down
|
||||
- include_tasks: tasks/assert-device_absent.yml
|
||||
- include_tasks: tasks/assert-profile_absent.yml
|
||||
- block:
|
||||
- include_tasks: tasks/run_test.yml
|
||||
vars:
|
||||
lsr_description: I can create a profile without autoconnect
|
||||
lsr_setup:
|
||||
- tasks/delete_interface.yml
|
||||
- tasks/assert_device_absent.yml
|
||||
lsr_test:
|
||||
- tasks/create_bridge_profile_no_autoconnect.yml
|
||||
lsr_assert:
|
||||
# Device should be absent because of autoconnect: false
|
||||
- tasks/assert_device_absent.yml
|
||||
- tasks/assert_profile_present.yml
|
||||
lsr_cleanup:
|
||||
- tasks/cleanup_profile+device.yml
|
||||
tags:
|
||||
- tests::states:create_without_autoconnect
|
||||
|
||||
- block:
|
||||
- include_tasks: tasks/run_test.yml
|
||||
vars:
|
||||
lsr_description: I can activate an existing profile
|
||||
lsr_setup:
|
||||
- tasks/create_bridge_profile.yml
|
||||
lsr_test:
|
||||
- tasks/activate_profile.yml
|
||||
lsr_assert:
|
||||
- tasks/assert_device_present.yml
|
||||
- tasks/assert_profile_present.yml
|
||||
lsr_cleanup:
|
||||
- tasks/cleanup_profile+device.yml
|
||||
tags:
|
||||
- tests::states:activate
|
||||
|
||||
- block:
|
||||
- include_tasks: tasks/run_test.yml
|
||||
vars:
|
||||
lsr_description: I can remove an existing profile without taking it
|
||||
down
|
||||
lsr_setup:
|
||||
- tasks/create_bridge_profile.yml
|
||||
- tasks/activate_profile.yml
|
||||
lsr_test:
|
||||
- tasks/remove_profile.yml
|
||||
lsr_assert:
|
||||
- tasks/assert_device_present.yml
|
||||
- tasks/assert_profile_absent.yml
|
||||
lsr_cleanup:
|
||||
- tasks/cleanup_profile+device.yml
|
||||
tags:
|
||||
- tests::states:remove_up
|
||||
|
||||
- block:
|
||||
- include_tasks: tasks/run_test.yml
|
||||
vars:
|
||||
lsr_description: I can take a profile down that is absent
|
||||
lsr_setup:
|
||||
- tasks/create_bridge_profile.yml
|
||||
- tasks/activate_profile.yml
|
||||
- tasks/remove_profile.yml
|
||||
lsr_test:
|
||||
- tasks/remove+down_profile.yml
|
||||
lsr_assert:
|
||||
- tasks/assert_profile_absent.yml
|
||||
lsr_assert_when:
|
||||
- what: tasks/assert_device_absent.yml
|
||||
when: "{{ network_provider == 'nm' }}"
|
||||
lsr_cleanup:
|
||||
- tasks/cleanup_profile+device.yml
|
||||
tags:
|
||||
- tests::states:remove_down
|
||||
|
||||
- block:
|
||||
- include_tasks: tasks/run_test.yml
|
||||
vars:
|
||||
lsr_description: I will not get an error when I try to
|
||||
remove an absent profile
|
||||
lsr_setup:
|
||||
- tasks/create_bridge_profile.yml
|
||||
- tasks/activate_profile.yml
|
||||
- tasks/remove+down_profile.yml
|
||||
lsr_test:
|
||||
- tasks/remove+down_profile.yml
|
||||
lsr_assert:
|
||||
- tasks/assert_profile_absent.yml
|
||||
# FIXME: This needs to be included before lsr_assert_when but
|
||||
# after the role ran to ensure that NetworkManager is actually
|
||||
# installed but it is not an assert.
|
||||
- tasks/get_NetworkManager_NVR.yml
|
||||
lsr_assert_when:
|
||||
- what: tasks/assert_device_absent.yml
|
||||
# NetworkManager 1.18.4 from CentOS does not seem to remove the
|
||||
# virtual interface in this case but it seems to work with
|
||||
# 1:NetworkManager-1.27.0-26129.d0a2eb8f05.el7
|
||||
when: "{{ network_provider == 'nm' and
|
||||
NetworkManager_NVR != 'NetworkManager-1.18.4-3.el7'
|
||||
}}"
|
||||
lsr_cleanup:
|
||||
- tasks/cleanup_profile+device.yml
|
||||
tags:
|
||||
- tests::states:remove_down_twice
|
||||
|
||||
Reference in New Issue
Block a user