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

@ -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

@ -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:

@ -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

@ -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:

@ -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:

@ -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) }}"

@ -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

@ -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 }}"

@ -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
}

@ -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

@ -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

@ -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:

@ -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:

@ -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

@ -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:

@ -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'

@ -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:
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']

@ -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 %}

@ -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
user:
name: unarchivetest1
uid: 1002610001
group: "{{ group_table[ansible_facts['distribution']] | default(omit) }}"
register: user
vars:

@ -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

@ -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/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
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

Loading…
Cancel
Save