summaryrefslogtreecommitdiff
path: root/test/integration/targets
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2020-08-07 14:28:10 -0500
committerGitHub <noreply@github.com>2020-08-07 14:28:10 -0500
commit7c60dadb9a3832dee0014113a337bc10fa1088c0 (patch)
treeb60f7cc1c219cf3eb13c0229ade2b05e7f934439 /test/integration/targets
parent56748a80609c5d402a8cf72c0a4396f87282957f (diff)
downloadansible-7c60dadb9a3832dee0014113a337bc10fa1088c0.tar.gz
Updates to Integration tests to pass against Alpine (#70946)
* Start of alpine testing * More updates * Add forgotten file * remove debug * Add alpine3 * equal * group 4 * group 4 * group 5 * Try to decrease test length * libuser only available in testing * Remove debug * Make loops target work on hosts without gnu date * Enable alpine testing * ci_complete * Don't specify uid for creating test user * ci_complete * Re-sort docker completion * use newer container image * ci_complete * fix indentation Co-authored-by: Matt Clay <matt@mystile.com> Co-authored-by: Matt Clay <matt@mystile.com>
Diffstat (limited to 'test/integration/targets')
-rw-r--r--test/integration/targets/ansible-galaxy-collection-scm/tasks/setup.yml2
-rw-r--r--test/integration/targets/ansible-galaxy/setup.yml2
-rwxr-xr-xtest/integration/targets/connection_ssh/runme.sh10
-rw-r--r--test/integration/targets/cron/tasks/main.yml4
-rw-r--r--test/integration/targets/getent/tasks/main.yml4
-rw-r--r--test/integration/targets/git/tasks/setup.yml2
-rw-r--r--test/integration/targets/group/tasks/tests.yml8
-rw-r--r--test/integration/targets/handler_race/roles/random_sleep/tasks/main.yml2
-rwxr-xr-xtest/integration/targets/include_import/runme.sh2
-rw-r--r--test/integration/targets/loops/tasks/main.yml25
-rw-r--r--test/integration/targets/pip/tasks/main.yml2
-rw-r--r--test/integration/targets/prepare_http_tests/tasks/default.yml8
-rw-r--r--test/integration/targets/pull/setup.yml2
-rw-r--r--test/integration/targets/service/tasks/main.yml4
-rw-r--r--test/integration/targets/service_facts/tasks/main.yml4
-rw-r--r--test/integration/targets/setup_cron/tasks/main.yml16
-rw-r--r--test/integration/targets/setup_cron/vars/alpine.yml1
-rw-r--r--test/integration/targets/setup_paramiko/install-Alpine-3-python-3.yml3
-rw-r--r--test/integration/targets/setup_paramiko/uninstall-Alpine-3-python-3.yml4
-rw-r--r--test/integration/targets/subversion/roles/subversion/tasks/setup.yml9
-rw-r--r--test/integration/targets/subversion/roles/subversion/templates/subversion.conf.j24
-rw-r--r--test/integration/targets/subversion/vars/Alpine.yml7
-rw-r--r--test/integration/targets/unarchive/tasks/test_unprivileged_user.yml1
-rw-r--r--test/integration/targets/user/tasks/main.yml4
24 files changed, 99 insertions, 31 deletions
diff --git a/test/integration/targets/ansible-galaxy-collection-scm/tasks/setup.yml b/test/integration/targets/ansible-galaxy-collection-scm/tasks/setup.yml
index f4beb9d61e..b83d3e78e7 100644
--- a/test/integration/targets/ansible-galaxy-collection-scm/tasks/setup.yml
+++ b/test/integration/targets/ansible-galaxy-collection-scm/tasks/setup.yml
@@ -1,7 +1,7 @@
- name: ensure git is installed
package:
name: git
- when: ansible_distribution != "MacOSX"
+ when: ansible_distribution not in ["MacOSX", "Alpine"]
register: git_install
- name: set git global user.email if not already set
diff --git a/test/integration/targets/ansible-galaxy/setup.yml b/test/integration/targets/ansible-galaxy/setup.yml
index a82d02aed2..ebd5a1c08b 100644
--- a/test/integration/targets/ansible-galaxy/setup.yml
+++ b/test/integration/targets/ansible-galaxy/setup.yml
@@ -3,7 +3,7 @@
- name: install git
package:
name: git
- when: ansible_distribution != "MacOSX"
+ when: ansible_distribution not in ["MacOSX", "Alpine"]
register: git_install
- name: save install result
copy:
diff --git a/test/integration/targets/connection_ssh/runme.sh b/test/integration/targets/connection_ssh/runme.sh
index e7b2b21f0b..32dbdd937b 100755
--- a/test/integration/targets/connection_ssh/runme.sh
+++ b/test/integration/targets/connection_ssh/runme.sh
@@ -22,12 +22,14 @@ if command -v sshpass > /dev/null; then
-e ansible_sshpass_prompt=notThis: \
-e ansible_password=foo \
-e ansible_user=definitelynotroot \
- -i test_connection.inventory \
+ -i test_connection.inventory \
ssh-pipelining
ret=$?
- if [[ $ret -ne 124 ]]; then
+ # 124 is EXIT_TIMEDOUT from gnu coreutils
+ # 143 is 128+SIGTERM(15) from BusyBox
+ if [[ $ret -ne 124 && $ret -ne 143 ]]; then
echo "Expected to time out and we did not. Exiting with failure."
- exit 1
+ exit 1
fi
else
ansible -m ping \
@@ -35,7 +37,7 @@ if command -v sshpass > /dev/null; then
-e ansible_sshpass_prompt=notThis: \
-e ansible_password=foo \
-e ansible_user=definitelynotroot \
- -i test_connection.inventory \
+ -i test_connection.inventory \
ssh-pipelining | grep 'customized password prompts'
ret=$?
[[ $ret -eq 0 ]] || exit $ret
diff --git a/test/integration/targets/cron/tasks/main.yml b/test/integration/targets/cron/tasks/main.yml
index 950d52dc4f..38898dc496 100644
--- a/test/integration/targets/cron/tasks/main.yml
+++ b/test/integration/targets/cron/tasks/main.yml
@@ -100,7 +100,9 @@
- assert:
that: remove_cron_file is not changed
+# BusyBox does not have /etc/cron.d
- name: Removing a cron file when the name is specified is allowed (#57471)
+ when: ansible_distribution != 'Alpine'
block:
- name: Cron file creation
cron:
@@ -124,6 +126,7 @@
that: not cron_file_stats.stat.exists
- name: Allow non-ascii chars in job (#69492)
+ when: ansible_distribution != 'Alpine'
block:
- name: Cron file creation
cron:
@@ -155,6 +158,7 @@
that: not cron_file_stats.stat.exists
- name: Allow non-ascii chars in cron_file (#69492)
+ when: ansible_distribution != 'Alpine'
block:
- name: Cron file creation with non-ascii filename (これは日本語です; This is Japanese)
cron:
diff --git a/test/integration/targets/getent/tasks/main.yml b/test/integration/targets/getent/tasks/main.yml
index 825ad5ea31..bd17bd6258 100644
--- a/test/integration/targets/getent/tasks/main.yml
+++ b/test/integration/targets/getent/tasks/main.yml
@@ -29,13 +29,13 @@
key: root
service: files
register: getent_test0
- when: ansible_system != 'FreeBSD'
+ when: ansible_system != 'FreeBSD' and ansible_distribution != 'Alpine'
- name: run getent w/o specified service (FreeBSD)
getent:
database: passwd
key: root
register: getent_test0
- when: ansible_system == 'FreeBSD'
+ when: ansible_system == 'FreeBSD' or ansible_distribution == 'Alpine'
- debug: var=getent_test0
- name: validate results
assert:
diff --git a/test/integration/targets/git/tasks/setup.yml b/test/integration/targets/git/tasks/setup.yml
index 16c56904ab..3158bf62d1 100644
--- a/test/integration/targets/git/tasks/setup.yml
+++ b/test/integration/targets/git/tasks/setup.yml
@@ -11,7 +11,7 @@
- name: SETUP | install git
package:
name: '{{ item }}'
- when: ansible_distribution != "MacOSX"
+ when: ansible_distribution not in ["MacOSX", "Alpine"]
notify:
- cleanup
with_items: "{{ git_required_packages[ansible_os_family | default('default') ] | default(git_required_packages.default) }}"
diff --git a/test/integration/targets/group/tasks/tests.yml b/test/integration/targets/group/tasks/tests.yml
index e35b23c916..0822682a2f 100644
--- a/test/integration/targets/group/tasks/tests.yml
+++ b/test/integration/targets/group/tasks/tests.yml
@@ -198,7 +198,13 @@
args:
name: libuser
state: present
- when: ansible_facts.system in ['Linux']
+ when: ansible_facts.system in ['Linux'] and ansible_distribution != 'Alpine'
+ tags:
+ - user_test_local_mode
+
+- name: Ensure lgroupadd is present - Alpine
+ command: apk add -U libuser --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
+ when: ansible_distribution == 'Alpine'
tags:
- user_test_local_mode
diff --git a/test/integration/targets/handler_race/roles/random_sleep/tasks/main.yml b/test/integration/targets/handler_race/roles/random_sleep/tasks/main.yml
index 607318bbd5..0bc4c382b6 100644
--- a/test/integration/targets/handler_race/roles/random_sleep/tasks/main.yml
+++ b/test/integration/targets/handler_race/roles/random_sleep/tasks/main.yml
@@ -2,7 +2,7 @@
# tasks file for random_sleep
- name: Generate sleep time
set_fact:
- sleep_time: "{{ 60 | random }}"
+ sleep_time: "{{ 30 | random }}"
- name: Do random sleep
shell: sleep "{{ sleep_time }}"
diff --git a/test/integration/targets/include_import/runme.sh b/test/integration/targets/include_import/runme.sh
index 6e26226fac..8b80dc54db 100755
--- a/test/integration/targets/include_import/runme.sh
+++ b/test/integration/targets/include_import/runme.sh
@@ -5,7 +5,7 @@ set -eux
export ANSIBLE_ROLES_PATH=./roles
function gen_task_files() {
- for i in $(seq -f '%03g' 1 39); do
+ for i in $(printf "%03d " {1..39}); do
echo -e "- name: Hello Message\n debug:\n msg: Task file ${i}" > "tasks/hello/tasks-file-${i}.yml"
done
}
diff --git a/test/integration/targets/loops/tasks/main.yml b/test/integration/targets/loops/tasks/main.yml
index 5575dd3649..a44abcd07f 100644
--- a/test/integration/targets/loops/tasks/main.yml
+++ b/test/integration/targets/loops/tasks/main.yml
@@ -27,20 +27,27 @@
block:
- name: Measure time before loop with .5s pause
set_fact:
- times: "{{times|default([]) + [ lookup('pipe','date +%s.%3N') ]}}"
+ times: "{{times|default([]) + [ now(fmt='%s.%f') ]}}"
with_sequence: count=3
loop_control:
pause: 0.6
- - name: ensure lag, since there is 3 rounds, and 0.5 seconds between, it should last 1.2 seconds, but allowing leeway due to CI lag
- assert:
- that:
- - tdiff|float >= 1.2
- - tdiff|int < 3
- vars:
+ - name: Debug times var
+ debug:
+ var: times
+
+ - vars:
tdiff: '{{ times[2]|float - times[0]|float }}'
- when:
- - ansible_facts['distribution'] not in ("MacOSX", "FreeBSD")
+ block:
+ - name: Debug tdiff used in next task
+ debug:
+ msg: 'tdiff={{ tdiff }}'
+
+ - name: ensure lag, since there is 3 rounds, and 0.5 seconds between, it should last 1.2 seconds, but allowing leeway due to CI lag
+ assert:
+ that:
+ - tdiff|float >= 1.2
+ - tdiff|int < 3
#
# Tests of loop syntax with args
diff --git a/test/integration/targets/pip/tasks/main.yml b/test/integration/targets/pip/tasks/main.yml
index 20e84d7943..89955e5ad9 100644
--- a/test/integration/targets/pip/tasks/main.yml
+++ b/test/integration/targets/pip/tasks/main.yml
@@ -15,7 +15,7 @@
package:
name: git
state: present
- when: ansible_distribution != "MacOSX"
+ when: ansible_distribution not in ["MacOSX", "Alpine"]
register: git_install
- include_tasks: pip.yml
diff --git a/test/integration/targets/prepare_http_tests/tasks/default.yml b/test/integration/targets/prepare_http_tests/tasks/default.yml
index 5f098e7206..6a1c8d2fe9 100644
--- a/test/integration/targets/prepare_http_tests/tasks/default.yml
+++ b/test/integration/targets/prepare_http_tests/tasks/default.yml
@@ -22,19 +22,19 @@
dest: "/etc/pki/trust/anchors/ansible.pem"
when: ansible_os_family == 'Suse'
-- name: Debian - Retrieve test cacert
+- name: Debian/Alpine - Retrieve test cacert
get_url:
url: "http://ansible.http.tests/cacert.pem"
dest: "/usr/local/share/ca-certificates/ansible.crt"
- when: ansible_os_family == 'Debian'
+ when: ansible_os_family in ['Debian', 'Alpine']
- name: Redhat - Update ca trust
command: update-ca-trust extract
when: ansible_os_family == 'RedHat'
-- name: Debian/Suse - Update ca certificates
+- name: Debian/Alpine/Suse - Update ca certificates
command: update-ca-certificates
- when: ansible_os_family == 'Debian' or ansible_os_family == 'Suse'
+ when: ansible_os_family in ['Debian', 'Alpine', 'Suse']
- name: FreeBSD - Retrieve test cacert
get_url:
diff --git a/test/integration/targets/pull/setup.yml b/test/integration/targets/pull/setup.yml
index a82d02aed2..ebd5a1c08b 100644
--- a/test/integration/targets/pull/setup.yml
+++ b/test/integration/targets/pull/setup.yml
@@ -3,7 +3,7 @@
- name: install git
package:
name: git
- when: ansible_distribution != "MacOSX"
+ when: ansible_distribution not in ["MacOSX", "Alpine"]
register: git_install
- name: save install result
copy:
diff --git a/test/integration/targets/service/tasks/main.yml b/test/integration/targets/service/tasks/main.yml
index 69a9ef205e..4fc2ddfe32 100644
--- a/test/integration/targets/service/tasks/main.yml
+++ b/test/integration/targets/service/tasks/main.yml
@@ -1,3 +1,7 @@
+- name: skip unsupported distros
+ meta: end_host
+ when: ansible_distribution in ['Alpine']
+
- name: install the test daemon script
copy:
src: ansible_test_service.py
diff --git a/test/integration/targets/service_facts/tasks/main.yml b/test/integration/targets/service_facts/tasks/main.yml
index 5a08fad300..d2d6528bce 100644
--- a/test/integration/targets/service_facts/tasks/main.yml
+++ b/test/integration/targets/service_facts/tasks/main.yml
@@ -3,6 +3,10 @@
# Copyright: (c) 2020, Abhijeet Kasurde <akasurde@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+- name: skip broken distros
+ meta: end_host
+ when: ansible_distribution == 'Alpine'
+
- name: Gather service facts
service_facts:
diff --git a/test/integration/targets/setup_cron/tasks/main.yml b/test/integration/targets/setup_cron/tasks/main.yml
index 93dcefa56e..c5a988e0a5 100644
--- a/test/integration/targets/setup_cron/tasks/main.yml
+++ b/test/integration/targets/setup_cron/tasks/main.yml
@@ -19,17 +19,23 @@
- when: faketime_pkg | default(false, true)
block:
- - name: install cron and faketime packages
+ - name: install faketime packages
package:
name: '{{ faketime_pkg }}'
register: faketime_package_installed
until: faketime_package_installed is success
+ when: ansible_distribution != 'Alpine'
+
+ - name: install faketime packages - Alpine
+ command: apk add -U {{ faketime_pkg }} --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
+ when: ansible_distribution == 'Alpine'
- name: Find libfaketime path
shell: '{{ list_pkg_files }} {{ faketime_pkg }} | grep -F libfaketime.so.1'
args:
warn: false
register: libfaketime_path
+ when: list_pkg_files is defined
- when: ansible_service_mgr == 'systemd'
block:
@@ -68,3 +74,11 @@
daemon-reload: "{{ (ansible_service_mgr == 'systemd') | ternary(true, omit) }}"
name: '{{ cron_service }}'
state: restarted
+ when: ansible_distribution != 'Alpine'
+
+- name: enable cron service - Alpine
+ command: nohup crond
+ environment:
+ FAKETIME: "+0y x10"
+ LD_PRELOAD: "/usr/lib/faketime/libfaketime.so.1"
+ when: ansible_distribution == 'Alpine'
diff --git a/test/integration/targets/setup_cron/vars/alpine.yml b/test/integration/targets/setup_cron/vars/alpine.yml
new file mode 100644
index 0000000000..37e6fc3714
--- /dev/null
+++ b/test/integration/targets/setup_cron/vars/alpine.yml
@@ -0,0 +1 @@
+faketime_pkg: libfaketime
diff --git a/test/integration/targets/setup_paramiko/install-Alpine-3-python-3.yml b/test/integration/targets/setup_paramiko/install-Alpine-3-python-3.yml
new file mode 100644
index 0000000000..a09f5b5500
--- /dev/null
+++ b/test/integration/targets/setup_paramiko/install-Alpine-3-python-3.yml
@@ -0,0 +1,3 @@
+- name: Install Paramiko for Python 3 on Alpine
+ pip: # no apk package manager in core, just use pip
+ name: paramiko
diff --git a/test/integration/targets/setup_paramiko/uninstall-Alpine-3-python-3.yml b/test/integration/targets/setup_paramiko/uninstall-Alpine-3-python-3.yml
new file mode 100644
index 0000000000..e9dcc62c68
--- /dev/null
+++ b/test/integration/targets/setup_paramiko/uninstall-Alpine-3-python-3.yml
@@ -0,0 +1,4 @@
+- name: Uninstall Paramiko for Python 3 on Alpine
+ pip:
+ name: paramiko
+ state: absent
diff --git a/test/integration/targets/subversion/roles/subversion/tasks/setup.yml b/test/integration/targets/subversion/roles/subversion/tasks/setup.yml
index 5c9c5cb541..f654efa66c 100644
--- a/test/integration/targets/subversion/roles/subversion/tasks/setup.yml
+++ b/test/integration/targets/subversion/roles/subversion/tasks/setup.yml
@@ -11,6 +11,11 @@
package:
name: '{{ subversion_packages }}'
state: present
+ when: ansible_distribution != 'Alpine'
+
+- name: install SVN pre-reqs - Alpine
+ command: 'apk add -U {{ subversion_packages|join(" ") }}'
+ when: ansible_distribution == 'Alpine'
- name: upgrade SVN pre-reqs
package:
@@ -55,9 +60,9 @@
- name: start test Apache SVN site - non Red Hat
command: apachectl -k start -f {{ subversion_server_dir }}/subversion.conf
- when: not ansible_os_family == 'RedHat'
+ when: ansible_os_family not in ['RedHat', 'Alpine']
# On Red Hat based OS', we can't use apachectl to start up own instance, just use the raw httpd
- name: start test Apache SVN site - Red Hat
command: httpd -k start -f {{ subversion_server_dir }}/subversion.conf
- when: ansible_os_family == 'RedHat'
+ when: ansible_os_family in ['RedHat', 'Alpine']
diff --git a/test/integration/targets/subversion/roles/subversion/templates/subversion.conf.j2 b/test/integration/targets/subversion/roles/subversion/templates/subversion.conf.j2
index 07e7083a6b..86f4070741 100644
--- a/test/integration/targets/subversion/roles/subversion/templates/subversion.conf.j2
+++ b/test/integration/targets/subversion/roles/subversion/templates/subversion.conf.j2
@@ -39,6 +39,10 @@ LoadModule authz_svn_module libexec/apache24/mod_authz_svn.so
Include /etc/apache2/httpd.conf
LoadModule dav_module /usr/lib64/apache2/mod_dav.so
LoadModule dav_svn_module /usr/lib64/apache2/mod_dav_svn.so
+{% elif ansible_os_family == "Alpine" %}
+Include /etc/apache2/httpd.conf
+LoadModule dav_module /usr/lib/apache2/mod_dav.so
+LoadModule dav_svn_module /usr/lib/apache2/mod_dav_svn.so
{% elif ansible_os_family == "RedHat" %}
Include /etc/httpd/conf/httpd.conf
{% endif %}
diff --git a/test/integration/targets/subversion/vars/Alpine.yml b/test/integration/targets/subversion/vars/Alpine.yml
new file mode 100644
index 0000000000..ce071fdd1c
--- /dev/null
+++ b/test/integration/targets/subversion/vars/Alpine.yml
@@ -0,0 +1,7 @@
+---
+subversion_packages:
+- subversion
+- mod_dav_svn
+- apache2-webdav
+apache_user: apache
+apache_group: apache
diff --git a/test/integration/targets/unarchive/tasks/test_unprivileged_user.yml b/test/integration/targets/unarchive/tasks/test_unprivileged_user.yml
index 6181e3bd62..e4c2bec561 100644
--- a/test/integration/targets/unarchive/tasks/test_unprivileged_user.yml
+++ b/test/integration/targets/unarchive/tasks/test_unprivileged_user.yml
@@ -1,7 +1,6 @@
- name: Create unarchivetest1 user
user:
name: unarchivetest1
- uid: 1002610001
group: "{{ group_table[ansible_facts['distribution']] | default(omit) }}"
register: user
vars:
diff --git a/test/integration/targets/user/tasks/main.yml b/test/integration/targets/user/tasks/main.yml
index 534dd92547..5b83166e69 100644
--- a/test/integration/targets/user/tasks/main.yml
+++ b/test/integration/targets/user/tasks/main.yml
@@ -17,6 +17,10 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
+- name: skip broken distros
+ meta: end_host
+ when: ansible_distribution == 'Alpine'
+
## user add
- name: remove the test user