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>
pull/71164/head
Matt Martz 4 years ago committed by GitHub
parent 56748a8060
commit 7c60dadb9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,6 +32,7 @@ matrix:
- env: T=rhel/8.2/1 - env: T=rhel/8.2/1
- env: T=freebsd/11.1/1 - env: T=freebsd/11.1/1
- env: T=freebsd/12.1/1 - env: T=freebsd/12.1/1
- env: T=linux/alpine3/1
- env: T=linux/centos6/1 - env: T=linux/centos6/1
- env: T=linux/centos7/1 - env: T=linux/centos7/1
- env: T=linux/centos8/1 - env: T=linux/centos8/1
@ -47,6 +48,7 @@ matrix:
- env: T=rhel/8.2/2 - env: T=rhel/8.2/2
- env: T=freebsd/11.1/2 - env: T=freebsd/11.1/2
- env: T=freebsd/12.1/2 - env: T=freebsd/12.1/2
- env: T=linux/alpine3/2
- env: T=linux/centos6/2 - env: T=linux/centos6/2
- env: T=linux/centos7/2 - env: T=linux/centos7/2
- env: T=linux/centos8/2 - env: T=linux/centos8/2
@ -62,6 +64,7 @@ matrix:
- env: T=rhel/8.2/3 - env: T=rhel/8.2/3
- env: T=freebsd/11.1/3 - env: T=freebsd/11.1/3
- env: T=freebsd/12.1/3 - env: T=freebsd/12.1/3
- env: T=linux/alpine3/3
- env: T=linux/centos6/3 - env: T=linux/centos6/3
- env: T=linux/centos7/3 - env: T=linux/centos7/3
- env: T=linux/centos8/3 - env: T=linux/centos8/3
@ -77,6 +80,7 @@ matrix:
- env: T=rhel/8.2/4 - env: T=rhel/8.2/4
- env: T=freebsd/11.1/4 - env: T=freebsd/11.1/4
- env: T=freebsd/12.1/4 - env: T=freebsd/12.1/4
- env: T=linux/alpine3/4
- env: T=linux/centos6/4 - env: T=linux/centos6/4
- env: T=linux/centos7/4 - env: T=linux/centos7/4
- env: T=linux/centos8/4 - env: T=linux/centos8/4
@ -92,6 +96,7 @@ matrix:
- env: T=rhel/8.2/5 - env: T=rhel/8.2/5
- env: T=freebsd/11.1/5 - env: T=freebsd/11.1/5
- env: T=freebsd/12.1/5 - env: T=freebsd/12.1/5
- env: T=linux/alpine3/5
- env: T=linux/centos6/5 - env: T=linux/centos6/5
- env: T=linux/centos7/5 - env: T=linux/centos7/5
- env: T=linux/centos8/5 - env: T=linux/centos8/5

@ -1,7 +1,7 @@
- name: ensure git is installed - name: ensure git is installed
package: package:
name: git name: git
when: ansible_distribution != "MacOSX" when: ansible_distribution not in ["MacOSX", "Alpine"]
register: git_install register: git_install
- name: set git global user.email if not already set - name: set git global user.email if not already set

@ -3,7 +3,7 @@
- name: install git - name: install git
package: package:
name: git name: git
when: ansible_distribution != "MacOSX" when: ansible_distribution not in ["MacOSX", "Alpine"]
register: git_install register: git_install
- name: save install result - name: save install result
copy: copy:

@ -22,12 +22,14 @@ if command -v sshpass > /dev/null; then
-e ansible_sshpass_prompt=notThis: \ -e ansible_sshpass_prompt=notThis: \
-e ansible_password=foo \ -e ansible_password=foo \
-e ansible_user=definitelynotroot \ -e ansible_user=definitelynotroot \
-i test_connection.inventory \ -i test_connection.inventory \
ssh-pipelining ssh-pipelining
ret=$? 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." echo "Expected to time out and we did not. Exiting with failure."
exit 1 exit 1
fi fi
else else
ansible -m ping \ ansible -m ping \
@ -35,7 +37,7 @@ if command -v sshpass > /dev/null; then
-e ansible_sshpass_prompt=notThis: \ -e ansible_sshpass_prompt=notThis: \
-e ansible_password=foo \ -e ansible_password=foo \
-e ansible_user=definitelynotroot \ -e ansible_user=definitelynotroot \
-i test_connection.inventory \ -i test_connection.inventory \
ssh-pipelining | grep 'customized password prompts' ssh-pipelining | grep 'customized password prompts'
ret=$? ret=$?
[[ $ret -eq 0 ]] || exit $ret [[ $ret -eq 0 ]] || exit $ret

@ -100,7 +100,9 @@
- assert: - assert:
that: remove_cron_file is not changed 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) - name: Removing a cron file when the name is specified is allowed (#57471)
when: ansible_distribution != 'Alpine'
block: block:
- name: Cron file creation - name: Cron file creation
cron: cron:
@ -124,6 +126,7 @@
that: not cron_file_stats.stat.exists that: not cron_file_stats.stat.exists
- name: Allow non-ascii chars in job (#69492) - name: Allow non-ascii chars in job (#69492)
when: ansible_distribution != 'Alpine'
block: block:
- name: Cron file creation - name: Cron file creation
cron: cron:
@ -155,6 +158,7 @@
that: not cron_file_stats.stat.exists that: not cron_file_stats.stat.exists
- name: Allow non-ascii chars in cron_file (#69492) - name: Allow non-ascii chars in cron_file (#69492)
when: ansible_distribution != 'Alpine'
block: block:
- name: Cron file creation with non-ascii filename (これは日本語です; This is Japanese) - name: Cron file creation with non-ascii filename (これは日本語です; This is Japanese)
cron: cron:

@ -29,13 +29,13 @@
key: root key: root
service: files service: files
register: getent_test0 register: getent_test0
when: ansible_system != 'FreeBSD' when: ansible_system != 'FreeBSD' and ansible_distribution != 'Alpine'
- name: run getent w/o specified service (FreeBSD) - name: run getent w/o specified service (FreeBSD)
getent: getent:
database: passwd database: passwd
key: root key: root
register: getent_test0 register: getent_test0
when: ansible_system == 'FreeBSD' when: ansible_system == 'FreeBSD' or ansible_distribution == 'Alpine'
- debug: var=getent_test0 - debug: var=getent_test0
- name: validate results - name: validate results
assert: assert:

@ -11,7 +11,7 @@
- name: SETUP | install git - name: SETUP | install git
package: package:
name: '{{ item }}' name: '{{ item }}'
when: ansible_distribution != "MacOSX" when: ansible_distribution not in ["MacOSX", "Alpine"]
notify: notify:
- cleanup - cleanup
with_items: "{{ git_required_packages[ansible_os_family | default('default') ] | default(git_required_packages.default) }}" with_items: "{{ git_required_packages[ansible_os_family | default('default') ] | default(git_required_packages.default) }}"

@ -198,7 +198,13 @@
args: args:
name: libuser name: libuser
state: present 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: tags:
- user_test_local_mode - user_test_local_mode

@ -2,7 +2,7 @@
# tasks file for random_sleep # tasks file for random_sleep
- name: Generate sleep time - name: Generate sleep time
set_fact: set_fact:
sleep_time: "{{ 60 | random }}" sleep_time: "{{ 30 | random }}"
- name: Do random sleep - name: Do random sleep
shell: sleep "{{ sleep_time }}" shell: sleep "{{ sleep_time }}"

@ -5,7 +5,7 @@ set -eux
export ANSIBLE_ROLES_PATH=./roles export ANSIBLE_ROLES_PATH=./roles
function gen_task_files() { 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" echo -e "- name: Hello Message\n debug:\n msg: Task file ${i}" > "tasks/hello/tasks-file-${i}.yml"
done done
} }

@ -27,20 +27,27 @@
block: block:
- name: Measure time before loop with .5s pause - name: Measure time before loop with .5s pause
set_fact: set_fact:
times: "{{times|default([]) + [ lookup('pipe','date +%s.%3N') ]}}" times: "{{times|default([]) + [ now(fmt='%s.%f') ]}}"
with_sequence: count=3 with_sequence: count=3
loop_control: loop_control:
pause: 0.6 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 - name: Debug times var
assert: debug:
that: var: times
- tdiff|float >= 1.2
- tdiff|int < 3 - vars:
vars:
tdiff: '{{ times[2]|float - times[0]|float }}' tdiff: '{{ times[2]|float - times[0]|float }}'
when: block:
- ansible_facts['distribution'] not in ("MacOSX", "FreeBSD") - 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 # Tests of loop syntax with args

@ -15,7 +15,7 @@
package: package:
name: git name: git
state: present state: present
when: ansible_distribution != "MacOSX" when: ansible_distribution not in ["MacOSX", "Alpine"]
register: git_install register: git_install
- include_tasks: pip.yml - include_tasks: pip.yml

@ -22,19 +22,19 @@
dest: "/etc/pki/trust/anchors/ansible.pem" dest: "/etc/pki/trust/anchors/ansible.pem"
when: ansible_os_family == 'Suse' when: ansible_os_family == 'Suse'
- name: Debian - Retrieve test cacert - name: Debian/Alpine - Retrieve test cacert
get_url: get_url:
url: "http://ansible.http.tests/cacert.pem" url: "http://ansible.http.tests/cacert.pem"
dest: "/usr/local/share/ca-certificates/ansible.crt" 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 - name: Redhat - Update ca trust
command: update-ca-trust extract command: update-ca-trust extract
when: ansible_os_family == 'RedHat' when: ansible_os_family == 'RedHat'
- name: Debian/Suse - Update ca certificates - name: Debian/Alpine/Suse - Update ca certificates
command: 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 - name: FreeBSD - Retrieve test cacert
get_url: get_url:

@ -3,7 +3,7 @@
- name: install git - name: install git
package: package:
name: git name: git
when: ansible_distribution != "MacOSX" when: ansible_distribution not in ["MacOSX", "Alpine"]
register: git_install register: git_install
- name: save install result - name: save install result
copy: copy:

@ -1,3 +1,7 @@
- name: skip unsupported distros
meta: end_host
when: ansible_distribution in ['Alpine']
- name: install the test daemon script - name: install the test daemon script
copy: copy:
src: ansible_test_service.py src: ansible_test_service.py

@ -3,6 +3,10 @@
# Copyright: (c) 2020, Abhijeet Kasurde <akasurde@redhat.com> # 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) # 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 - name: Gather service facts
service_facts: service_facts:

@ -19,17 +19,23 @@
- when: faketime_pkg | default(false, true) - when: faketime_pkg | default(false, true)
block: block:
- name: install cron and faketime packages - name: install faketime packages
package: package:
name: '{{ faketime_pkg }}' name: '{{ faketime_pkg }}'
register: faketime_package_installed register: faketime_package_installed
until: faketime_package_installed is success 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 - name: Find libfaketime path
shell: '{{ list_pkg_files }} {{ faketime_pkg }} | grep -F libfaketime.so.1' shell: '{{ list_pkg_files }} {{ faketime_pkg }} | grep -F libfaketime.so.1'
args: args:
warn: false warn: false
register: libfaketime_path register: libfaketime_path
when: list_pkg_files is defined
- when: ansible_service_mgr == 'systemd' - when: ansible_service_mgr == 'systemd'
block: block:
@ -68,3 +74,11 @@
daemon-reload: "{{ (ansible_service_mgr == 'systemd') | ternary(true, omit) }}" daemon-reload: "{{ (ansible_service_mgr == 'systemd') | ternary(true, omit) }}"
name: '{{ cron_service }}' name: '{{ cron_service }}'
state: restarted 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'

@ -0,0 +1,3 @@
- name: Install Paramiko for Python 3 on Alpine
pip: # no apk package manager in core, just use pip
name: paramiko

@ -0,0 +1,4 @@
- name: Uninstall Paramiko for Python 3 on Alpine
pip:
name: paramiko
state: absent

@ -11,6 +11,11 @@
package: package:
name: '{{ subversion_packages }}' name: '{{ subversion_packages }}'
state: present 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 - name: upgrade SVN pre-reqs
package: package:
@ -55,9 +60,9 @@
- name: start test Apache SVN site - non Red Hat - name: start test Apache SVN site - non Red Hat
command: apachectl -k start -f {{ subversion_server_dir }}/subversion.conf 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 # 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 - name: start test Apache SVN site - Red Hat
command: httpd -k start -f {{ subversion_server_dir }}/subversion.conf command: httpd -k start -f {{ subversion_server_dir }}/subversion.conf
when: ansible_os_family == 'RedHat' when: ansible_os_family in ['RedHat', 'Alpine']

@ -39,6 +39,10 @@ LoadModule authz_svn_module libexec/apache24/mod_authz_svn.so
Include /etc/apache2/httpd.conf Include /etc/apache2/httpd.conf
LoadModule dav_module /usr/lib64/apache2/mod_dav.so LoadModule dav_module /usr/lib64/apache2/mod_dav.so
LoadModule dav_svn_module /usr/lib64/apache2/mod_dav_svn.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" %} {% elif ansible_os_family == "RedHat" %}
Include /etc/httpd/conf/httpd.conf Include /etc/httpd/conf/httpd.conf
{% endif %} {% endif %}

@ -0,0 +1,7 @@
---
subversion_packages:
- subversion
- mod_dav_svn
- apache2-webdav
apache_user: apache
apache_group: apache

@ -1,7 +1,6 @@
- name: Create unarchivetest1 user - name: Create unarchivetest1 user
user: user:
name: unarchivetest1 name: unarchivetest1
uid: 1002610001
group: "{{ group_table[ansible_facts['distribution']] | default(omit) }}" group: "{{ group_table[ansible_facts['distribution']] | default(omit) }}"
register: user register: user
vars: vars:

@ -17,6 +17,10 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# #
- name: skip broken distros
meta: end_host
when: ansible_distribution == 'Alpine'
## user add ## user add
- name: remove the test user - name: remove the test user

@ -1,5 +1,6 @@
default name=quay.io/ansible/default-test-container:2.6.0 python=3.6,2.6,2.7,3.5,3.7,3.8,3.9 seccomp=unconfined context=collection default name=quay.io/ansible/default-test-container:2.6.0 python=3.6,2.6,2.7,3.5,3.7,3.8,3.9 seccomp=unconfined context=collection
default name=quay.io/ansible/ansible-base-test-container:1.5.0 python=3.6,2.6,2.7,3.5,3.7,3.8,3.9 seccomp=unconfined context=ansible-base default name=quay.io/ansible/ansible-base-test-container:1.5.0 python=3.6,2.6,2.7,3.5,3.7,3.8,3.9 seccomp=unconfined context=ansible-base
alpine3 name=quay.io/ansible/alpine3-test-container:1.19.0 python=3.8
centos6 name=quay.io/ansible/centos6-test-container:1.17.0 python=2.6 seccomp=unconfined centos6 name=quay.io/ansible/centos6-test-container:1.17.0 python=2.6 seccomp=unconfined
centos7 name=quay.io/ansible/centos7-test-container:1.17.0 python=2.7 seccomp=unconfined centos7 name=quay.io/ansible/centos7-test-container:1.17.0 python=2.7 seccomp=unconfined
centos8 name=quay.io/ansible/centos8-test-container:1.17.0 python=3.6 seccomp=unconfined centos8 name=quay.io/ansible/centos8-test-container:1.17.0 python=3.6 seccomp=unconfined

Loading…
Cancel
Save