Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests on ubuntu1604 and opensuseleap #15936

Merged
merged 4 commits into from
May 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions test/integration/roles/prepare_http_tests/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# The docker --link functionality gives us an ENV var we can key off of to see if we have access to
# the httptester container
- set_fact:
has_httptester: "{{ lookup('env', 'ANSIBLE.HTTP.TESTS_PORT_80_TCP_ADDR') != '' }}"
has_httptester: "{{ lookup('env', 'HTTPTESTER') != '' }}"

# If we are running with access to a httptester container, grab it's cacert and install it
- block:
Expand All @@ -18,6 +18,12 @@
dest: "/etc/pki/ca-trust/source/anchors/ansible.pem"
when: ansible_os_family == 'RedHat'

- name: Suse - Retrieve test cacert
get_url:
url: "http://ansible.http.tests/cacert.pem"
dest: "/etc/pki/trust/anchors/ansible.pem"
when: ansible_os_family == 'Suse'

- name: Debian - Retrieve test cacert
get_url:
url: "http://ansible.http.tests/cacert.pem"
Expand All @@ -28,8 +34,8 @@
command: update-ca-trust extract
when: ansible_os_family == 'RedHat'

- name: Debian - Update ca certificates
- name: Debian/Suse - Update ca certificates
command: update-ca-certificates
when: ansible_os_family == 'Debian'
when: ansible_os_family == 'Debian' or ansible_os_family == 'Suse'

when: has_httptester|bool
6 changes: 6 additions & 0 deletions test/integration/roles/setup_mysql_db/vars/Suse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mysql_service: 'mysql'

mysql_packages:
- mariadb
- python-MySQL-python
- bzip2
32 changes: 13 additions & 19 deletions test/integration/roles/setup_postgresql_db/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,10 @@
paths: '../vars'

# Make sure we start fresh
- name: remove rpm dependencies for postgresql test
package: name={{ postgresql_package_item }} state=absent
with_items: "{{postgresql_packages}}"
loop_control:
loop_var: postgresql_package_item
when: ansible_os_family == "RedHat"

- name: remove dpkg dependencies for postgresql test
apt: name={{ postgresql_package_item }} state=absent
with_items: "{{postgresql_packages}}"
loop_control:
loop_var: postgresql_package_item
when: ansible_pkg_mgr == 'apt'

- name: remove old db (red hat)
- name: remove old db (RedHat or Suse)
command: rm -rf "{{ pg_dir }}"
ignore_errors: True
when: ansible_os_family == "RedHat"
when: ansible_os_family == "RedHat" or ansible_os_family == "Suse"

# Theoretically, pg_dropcluster should work but it doesn't so rm files
- name: remove old db config (debian)
Expand All @@ -43,7 +29,7 @@
with_items: "{{postgresql_packages}}"
loop_control:
loop_var: postgresql_package_item
when: ansible_os_family == "RedHat"
when: ansible_os_family == "RedHat" or ansible_os_family == "Suse"

- name: install dpkg dependencies for postgresql test
apt: name={{ postgresql_package_item }} state=latest
Expand All @@ -66,6 +52,10 @@
ignore_errors: True
when: ansible_os_family == 'Debian'

- name: Initialize postgres (Suse)
service: name=postgresql state=restarted
when: ansible_os_family == 'Suse'

- name: Copy pg_hba into place
copy: src=pg_hba.conf dest="{{ pg_hba_location }}" owner="postgres" group="root" mode="0644"

Expand All @@ -77,13 +67,17 @@
command: locale-gen es_MX
when: ansible_os_family == 'Debian'

- name: install i18ndata
zypper: name=glibc-i18ndata state=present
when: ansible_os_family == 'Suse'

- name: Generate pt_BR locale (Red Hat)
command: localedef -f ISO-8859-1 -i pt_BR pt_BR
when: ansible_os_family == 'RedHat'
when: ansible_os_family == "RedHat" or ansible_os_family == "Suse"

- name: Generate es_MX locale (Red Hat)
command: localedef -f ISO-8859-1 -i es_MX es_MX
when: ansible_os_family == 'RedHat'
when: ansible_os_family == "RedHat" or ansible_os_family == "Suse"

- name: restart postgresql service
service: name={{ postgresql_service }} state=restarted
5 changes: 3 additions & 2 deletions test/integration/roles/test_async/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
# test async "fire and forget, but check later"

- name: 'start a task with "fire-and-forget"'
command: sleep 15
command: sleep 3
async: 30
poll: 0
register: fnf_task
Expand All @@ -80,7 +80,8 @@
async_status: jid={{ fnf_task.ansible_job_id }}
register: fnf_result
until: fnf_result.finished
retries: 30
retries: 10
delay: 1

- name: assert task was successfully checked
assert:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@
- name: create user2 state=present with a password
mysql_user: name={{ user_name_2 }} password={{ user_password_2 }} priv=*.*:ALL state=present

- name: store user2 grants with old password
- name: store user2 grants with old password (mysql 5.7.6 and newer)
command: mysql "-e SHOW CREATE USER '{{ user_name_2 }}'@'localhost';"
register: user_password_old_create
ignore_errors: yes

- name: store user2 grants with old password (mysql 5.7.5 and older)
command: mysql "-e SHOW GRANTS FOR '{{ user_name_2 }}'@'localhost';"
register: user_password_old
when: user_password_old_create|failed

# FIXME: not sure why this is failing, but it looks like it should expect changed=true
#- name: update user2 state=present with same password (expect changed=false)
Expand All @@ -46,12 +52,23 @@

- include: assert_user.yml user_name={{user_name_2}} priv='ALL PRIVILEGES'

- name: store user2 grants with old password (mysql 5.7.6 and newer)
command: mysql "-e SHOW CREATE USER '{{ user_name_2 }}'@'localhost';"
register: user_password_new_create
ignore_errors: yes

- name: store user2 grants with new password
command: mysql "-e SHOW GRANTS FOR '{{ user_name_2 }}'@'localhost';"
register: user_password_new
when: user_password_new_create|failed

- name: assert output message password was update for user2 (mysql 5.7.6 and newer)
assert: { that: "user_password_old_create.stdout != user_password_new_create.stdout" }
when: not user_password_new_create|failed

- name: assert output message password was update for user2
- name: assert output message password was update for user2 (mysql 5.7.5 and older)
assert: { that: "user_password_old.stdout != user_password_new.stdout" }
when: user_password_new_create|failed

- name: create database using user2 and old password
mysql_db: name={{ db_name }} state=present login_user={{ user_name_2 }} login_password={{ user_password_2 }}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/roles/test_service/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- include: 'sysv_setup.yml'
when: ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and (ansible_distribution_version|version_compare('6', '>=') and ansible_distribution_version|version_compare('7', '<'))
- include: 'systemd_setup.yml'
when: (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and (ansible_distribution_version|version_compare('7', '>=') and ansible_distribution_version|version_compare('8', '<'))) or ansible_distribution == 'Fedora' or (ansible_distribution == 'Ubuntu' and ansible_distribution_version|version_compare('15.04', '>=')) or (ansible_distribution == 'Debian' and ansible_distribution_version|version_compare('8', '>='))
when: (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and (ansible_distribution_version|version_compare('7', '>=') and ansible_distribution_version|version_compare('8', '<'))) or ansible_distribution == 'Fedora' or (ansible_distribution == 'Ubuntu' and ansible_distribution_version|version_compare('15.04', '>=')) or (ansible_distribution == 'Debian' and ansible_distribution_version|version_compare('8', '>=')) or ansible_os_family == 'Suse'
- include: 'upstart_setup.yml'
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version|version_compare('15.04', '<')

Expand Down
2 changes: 1 addition & 1 deletion test/integration/roles/test_uri/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
- ndg-httpsclient
when: not ansible_python.has_sslcontext and not is_ubuntu_precise|bool

- name: Verify SNI verificaiton succeeds on old python with urllib3 contrib
- name: Verify SNI verification succeeds on old python with urllib3 contrib
uri:
url: 'https://{{ sni_host }}'
return_content: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---

- name: ensure zypper ref works
command: zypper -n ref

- name: Delete
zypper_repository:
name: test
Expand Down Expand Up @@ -42,6 +47,11 @@
that:
- "zypper_result.changed"

- name: Remove repo by name (also to not mess up later tasks)
zypper_repository:
name: test
state: absent

- name: use refresh option
zypper_repository:
name: testrefresh
Expand Down Expand Up @@ -83,29 +93,51 @@

- name: check repo is updated by url
command: zypper lr oss1
register: zypper_result
register: zypper_result1
ignore_errors: yes

- name: check repo is updated by url
command: zypper lr oss2
register: zypper_result2

- assert:
that:
- "zypper_result.rc == 6"
- "'not found' in zypper_result.stderr"
- "zypper_result1.rc == 6"
- "'not found' in zypper_result1.stderr"
- "zypper_result2.rc == 0"
- "'http://download.opensuse.org/distribution/leap/42.1/repo/oss/' in zypper_result2.stdout"


- name: reset oss repo (to not break zypper later)
zypper_repository:
name: OSS
state: present
repo: http://download.opensuse.org/distribution/leap/42.1/repo/oss/
priority: 99
refresh: yes

- name: add two repos with same name
zypper_repository:
name: samename
state: present
repo: "http://download.opensuse.org/distribution/leap/42.1/repo/{{item}}/"
repo: "{{ item }}"
with_items:
- oss
- non-oss
- http://download.opensuse.org/repositories/science/openSUSE_Leap_42.1/
- http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_Leap_42.1/

- name: check repo is updated by name
command: zypper lr samename
register: zypper_result

- assert:
that:
- "'/oss/' not in zypper_result.stdout"
- "'/non-oss/' in zypper_result.stdout"
- "'/science/' not in zypper_result.stdout"
- "'/devel:/languages:/python/' in zypper_result.stdout"

- name: remove last added repos (by URL to test that)
zypper_repository:
repo: http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_Leap_42.1/
state: absent

- name: ensure zypper ref still works
command: zypper -n ref
2 changes: 2 additions & 0 deletions test/utils/docker/opensuseleap/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ RUN zypper --non-interactive install --auto-agree-with-licenses \
acl \
asciidoc \
bzip2 \
curl \
dbus-1-python \
gcc \
git \
glibc-locale \
glibc-i18ndata \
iproute \
lsb-release \
make \
Expand Down
2 changes: 1 addition & 1 deletion test/utils/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ else
fi
export C_NAME="testAbull_$$_$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)"
docker pull ansible/ansible:${TARGET}
docker run -d --volume="${PWD}:/root/ansible:Z" $LINKS --name "${C_NAME}" ${TARGET_OPTIONS:=''} ansible/ansible:${TARGET} > /tmp/cid_${TARGET}
docker run -d --volume="${PWD}:/root/ansible:Z" $LINKS --name "${C_NAME}" --env HTTPTESTER=1 ${TARGET_OPTIONS:=''} ansible/ansible:${TARGET} > /tmp/cid_${TARGET}
docker exec -ti $(cat /tmp/cid_${TARGET}) /bin/sh -c "export TEST_FLAGS='${TEST_FLAGS:-''}'; cd /root/ansible; . hacking/env-setup; (cd test/integration; LC_ALL=en_US.utf-8 make ${MAKE_TARGET:-})"
docker kill $(cat /tmp/cid_${TARGET})

Expand Down