From ac7505d624ffba3c4fe3e4f2bc9314bad2343e1f Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Sun, 21 Feb 2021 20:52:58 +0000 Subject: [PATCH] tests: Add centos 8; debian 10, 11; ubuntu 16.04, 18.04, 20.04 test images --- .../runner/custom_binary_single_null.yml | 14 +++++++++--- tests/image_prep/_container_setup.yml | 22 +++++++++++++++++++ tests/image_prep/host_vars/centos8.yml | 10 +++++++++ tests/image_prep/host_vars/debian10.yml | 11 ++++++++++ tests/image_prep/host_vars/debian11.yml | 11 ++++++++++ tests/image_prep/host_vars/ubuntu1604.yml | 11 ++++++++++ tests/image_prep/host_vars/ubuntu1804.yml | 11 ++++++++++ tests/image_prep/host_vars/ubuntu2004.yml | 11 ++++++++++ tests/image_prep/hosts.ini | 9 ++++++++ 9 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 tests/image_prep/host_vars/centos8.yml create mode 100644 tests/image_prep/host_vars/debian10.yml create mode 100644 tests/image_prep/host_vars/debian11.yml create mode 100644 tests/image_prep/host_vars/ubuntu1604.yml create mode 100644 tests/image_prep/host_vars/ubuntu1804.yml create mode 100644 tests/image_prep/host_vars/ubuntu2004.yml diff --git a/tests/ansible/integration/runner/custom_binary_single_null.yml b/tests/ansible/integration/runner/custom_binary_single_null.yml index 8e215bf3..ce96bf13 100644 --- a/tests/ansible/integration/runner/custom_binary_single_null.yml +++ b/tests/ansible/integration/runner/custom_binary_single_null.yml @@ -15,10 +15,18 @@ - "out.failed" - "out.results[0].failed" - "out.results[0].msg.startswith('MODULE FAILURE')" - - "out.results[0].module_stdout.startswith('/bin/sh: ')" + # On Ubuntu 16.04 /bin/sh is dash 0.5.8. It treats custom_binary_single_null + # as a valid executable. There's no error message, and rc == 0. - | - out.results[0].module_stdout.endswith('custom_binary_single_null: cannot execute binary file\r\n') or - out.results[0].module_stdout.endswith('custom_binary_single_null: Exec format error\r\n') + out.results[0].module_stdout.startswith('/bin/sh: ') + or (ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_version == '16.04') + - | + out.results[0].module_stdout.endswith(( + 'custom_binary_single_null: cannot execute binary file\r\n', + 'custom_binary_single_null: Exec format error\r\n', + 'custom_binary_single_null: cannot execute binary file: Exec format error\r\n', + )) + or (ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_version == '16.04') # Can't test this: Mitogen returns 126, 2.5.x returns 126, 2.4.x discarded the diff --git a/tests/image_prep/_container_setup.yml b/tests/image_prep/_container_setup.yml index c564f1a1..353a7d5b 100644 --- a/tests/image_prep/_container_setup.yml +++ b/tests/image_prep/_container_setup.yml @@ -42,11 +42,19 @@ update_cache: true when: ansible_pkg_mgr == 'yum' + - name: Ensure requisite dnf packages are installed + dnf: + name: "{{ common_packages + packages }}" + state: present + update_cache: true + when: ansible_pkg_mgr == 'dnf' + - name: Clean up package cache vars: clean_command: apt: apt-get clean yum: yum clean all + dnf: dnf clean all command: "{{ clean_command[ansible_pkg_mgr] }}" args: warn: false @@ -58,6 +66,11 @@ - /var/lib/apt/lists when: ansible_pkg_mgr == 'apt' + - name: Configure /usr/bin/python + command: alternatives --set python /usr/bin/python3.8 + args: + creates: /usr/bin/python + when: inventory_hostname in ["centos8"] - name: Enable UTF-8 locale on Debian copy: @@ -173,6 +186,15 @@ regexp: '.*session.*required.*pam_loginuid.so' line: session optional pam_loginuid.so + # Normally this would be removed by systemd-networkd-wait-online. If + # present ssh works only for root. The message displayed is + # > System is booting up. Unprivileged users are not permitted to log in + # > yet. Please come back later. For technical details, see pam_nologin(8). + - name: Remove login lockout + file: + path: /run/nologin + state: absent + - name: Install convenience script for running an straced Python copy: mode: 'u+rwx,go=rx' diff --git a/tests/image_prep/host_vars/centos8.yml b/tests/image_prep/host_vars/centos8.yml new file mode 100644 index 00000000..17eccd01 --- /dev/null +++ b/tests/image_prep/host_vars/centos8.yml @@ -0,0 +1,10 @@ +bootstrap_packages: [python3] + +docker_base: centos:8 + +packages: + - perl-JSON + - python2-virtualenv + - python3-virtualenv + - python36 + - python38 diff --git a/tests/image_prep/host_vars/debian10.yml b/tests/image_prep/host_vars/debian10.yml new file mode 100644 index 00000000..1b03d6a2 --- /dev/null +++ b/tests/image_prep/host_vars/debian10.yml @@ -0,0 +1,11 @@ +bootstrap_packages: [python] + +docker_base: debian:10 + +packages: + - libjson-perl + - locales + - python-virtualenv + - python3 + - python3-virtualenv + - virtualenv diff --git a/tests/image_prep/host_vars/debian11.yml b/tests/image_prep/host_vars/debian11.yml new file mode 100644 index 00000000..5ab2d761 --- /dev/null +++ b/tests/image_prep/host_vars/debian11.yml @@ -0,0 +1,11 @@ +bootstrap_packages: [python3, python3-apt] + +docker_base: debian:bullseye + +packages: + - libjson-perl + - locales + - python-is-python3 + - python2 + - python3-virtualenv + - virtualenv diff --git a/tests/image_prep/host_vars/ubuntu1604.yml b/tests/image_prep/host_vars/ubuntu1604.yml new file mode 100644 index 00000000..461e522d --- /dev/null +++ b/tests/image_prep/host_vars/ubuntu1604.yml @@ -0,0 +1,11 @@ +bootstrap_packages: [python] + +docker_base: ubuntu:16.04 + +packages: + - libjson-perl + - locales + - python-virtualenv + - python3 + - python3-virtualenv + - virtualenv diff --git a/tests/image_prep/host_vars/ubuntu1804.yml b/tests/image_prep/host_vars/ubuntu1804.yml new file mode 100644 index 00000000..4c913e2d --- /dev/null +++ b/tests/image_prep/host_vars/ubuntu1804.yml @@ -0,0 +1,11 @@ +bootstrap_packages: [python] + +docker_base: ubuntu:18.04 + +packages: + - libjson-perl + - locales + - python-virtualenv + - python3 + - python3-virtualenv + - virtualenv diff --git a/tests/image_prep/host_vars/ubuntu2004.yml b/tests/image_prep/host_vars/ubuntu2004.yml new file mode 100644 index 00000000..4ee5b331 --- /dev/null +++ b/tests/image_prep/host_vars/ubuntu2004.yml @@ -0,0 +1,11 @@ +bootstrap_packages: [python3] + +docker_base: ubuntu:20.04 + +packages: + - libjson-perl + - locales + - python-is-python3 + - python2 + - python3-virtualenv + - virtualenv diff --git a/tests/image_prep/hosts.ini b/tests/image_prep/hosts.ini index 9c756f51..68f8be62 100644 --- a/tests/image_prep/hosts.ini +++ b/tests/image_prep/hosts.ini @@ -1,6 +1,7 @@ [all:children] centos debian +ubuntu [all:vars] ansible_connection = docker @@ -9,6 +10,14 @@ ansible_connection = docker centos5 centos6 centos7 +centos8 [debian] debian9 +debian10 +debian11 + +[ubuntu] +ubuntu1604 +ubuntu1804 +ubuntu2004