summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSviatoslav Sydorenko <wk@sydorenko.org.ua>2022-12-06 23:30:46 +0100
committerGitHub <noreply@github.com>2022-12-06 14:30:46 -0800
commita258e013bb462b61557a857f40a90540361a831f (patch)
tree96d7292632c45609726fdcc1da28b305f0add0c2
parent4c5069047c60d1bfba15998f3d5a9c3dfe0c7bc4 (diff)
downloadansible-a258e013bb462b61557a857f40a90540361a831f.tar.gz
[backport][2.12][PRs #78402 #79289] Enable the `reboot` integration test in CI (#79492)
* Enable the `reboot` integration test in CI Co-Authored-By: Matt Clay <matt@mystile.com> (cherry picked from commit bb7ad0f0d8febb5020eec36bb4a52cc95c9a4486) * [CI] Move running `reboot` integration test to group 2 PR #79289, follow-up for #78402. It was breaking the integration-aliases sanity test, but only became apparent post-merge. This patch fixes that. (cherry picked from commit 26a477561168cd731c86fb1ceffb0394c81cb0a7) Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.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 e9bebbf31a..7f995fd6d8 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/group2
+skip/docker
diff --git a/test/integration/targets/reboot/tasks/main.yml b/test/integration/targets/reboot/tasks/main.yml
index 7687cb73ce..4884f10448 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