Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ansible/ansible.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSviatoslav Sydorenko <wk@sydorenko.org.ua>2022-08-01 21:20:17 +0300
committerSviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>2022-11-02 04:56:54 +0300
commitbb7ad0f0d8febb5020eec36bb4a52cc95c9a4486 (patch)
treedae3b12cac6ed1d43a2acd41cf031713ec01b5b2
parent698da30c1e68957bcb60ce72181e6ac72e367e15 (diff)
Enable the `reboot` integration test in CI
Co-Authored-By: Matt Clay <matt@mystile.com>
-rw-r--r--test/integration/targets/reboot/aliases7
-rw-r--r--test/integration/targets/reboot/tasks/main.yml68
2 files changed, 40 insertions, 35 deletions
diff --git a/test/integration/targets/reboot/aliases b/test/integration/targets/reboot/aliases
index e9bebbf31a6..c8e6bbcda8f 100644
--- a/test/integration/targets/reboot/aliases
+++ b/test/integration/targets/reboot/aliases
@@ -1,2 +1,5 @@
-# No current way to split controller and test node
-unsupported
+context/target
+destructive
+needs/root
+shippable/posix/group3
+skip/docker
diff --git a/test/integration/targets/reboot/tasks/main.yml b/test/integration/targets/reboot/tasks/main.yml
index 7687cb73ce1..4884f104488 100644
--- a/test/integration/targets/reboot/tasks/main.yml
+++ b/test/integration/targets/reboot/tasks/main.yml
@@ -1,39 +1,41 @@
-- name: Test reboot
- when: ansible_facts.virtualization_type | default('') not in ['docker', 'container', 'containerd']
- block:
- # This block can be removed once we have a mechanism in ansible-test to separate
- # the control node from the managed node.
- - block:
- - name: Write temp file for sanity checking this is not the controller
- copy:
- content: 'I am the control node'
- dest: /tmp/Anything-Nutlike-Nuzzle-Plow-Overdue
- delegate_to: localhost
- connection: local
- when: inventory_hostname == ansible_play_hosts[0]
+- name: Check split state
+ stat:
+ path: "{{ output_dir }}"
+ register: split
+ ignore_errors: yes
+
+- name: >-
+ Memorize whether we're in a containerized environment
+ and/or a split controller mode
+ set_fact:
+ in_container_env: >-
+ {{
+ ansible_facts.virtualization_type | default('')
+ in ['docker', 'container', 'containerd']
+ }}
+ in_split_controller_mode: >-
+ {{ split is not success or not split.stat.exists }}
- - name: See if the temp file exists on the managed node
- stat:
- path: /tmp/Anything-Nutlike-Nuzzle-Plow-Overdue
- register: controller_temp_file
+- name: Explain why testing against a container is not an option
+ debug:
+ msg: >-
+ This test is attempting to reboot the whole host operating system.
+ The current target is a containerized environment. Containers
+ cannot be reboot like VMs. This is why the test is being skipped.
+ when: in_container_env
- - name: EXPECT FAILURE | Check if the managed node is the control node
- assert:
- msg: >
- This test must be run manually by modifying the inventory file to point
- "{{ inventory_hostname }}" at a remote host rather than "{{ ansible_host }}".
- Skipping reboot test.
- that:
- - not controller_temp_file.stat.exists
- always:
- - name: Cleanup temp file
- file:
- path: /tmp/Anything-Nutlike-Nuzzle-Plow-Overdue
- state: absent
- delegate_to: localhost
- connection: local
- when: inventory_hostname == ansible_play_hosts[0]
+- name: Explain why testing against the same host is not an option
+ debug:
+ msg: >-
+ This test is attempting to reboot the whole host operating system.
+ This means it would interrupt itself trying to reboot own
+ environment. It needs to target a separate VM or machine to be
+ able to function so it's being skipped in the current invocation.
+ when: not in_split_controller_mode
+- name: Test reboot
+ when: not in_container_env and in_split_controller_mode
+ block:
- import_tasks: test_standard_scenarios.yml
- import_tasks: test_reboot_command.yml
- import_tasks: test_invalid_parameter.yml