1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix more tests (#66)

* Fix permissions.

* Fix more FQCNs.

* Adjust more ansible_pkg_mgr usages.

* Fix plugin FQCN.

* Change port 12345 -> 12347.

* Print port usage first.

* Support both short and long name.

* Revert "Print port usage first."

This reverts commit ea1dbc60f08a2664a8b01abba7aa7610bc2a23f1.

* Revert "Change port 12345 -> 12347."

This reverts commit cbc13510ee9f855110b4134517b2a548745a1fb0.

* Fix cleanup.

* Add more FQCNs.

* Allow short name as well.

ci_complete

* Add remaining ignore.txt entries for ipaddress.

* Remove kubevirt ignore.txt entries.

* Added missing entries, and sorted.

* Remove superfluous fact gathering.

* Fix FQCNs.

* Temporarily disable supervisorctl (fails on OSX because socket path is too long)

* Add missing file.

* Fix permissions.

ci_complete
This commit is contained in:
Felix Fontein 2020-03-30 11:06:48 +02:00 committed by GitHub
parent 14731bf485
commit 027ffcae56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 527 additions and 408 deletions

View file

@ -23,7 +23,7 @@
- libapache2-mod-evasive
- name: install apache via zypper
zypper:
community.general.zypper:
name: apache2
state: present
when: "ansible_os_family == 'Suse'"

View file

@ -19,11 +19,11 @@
- name: Ensure zip is present to create test archive (yum)
yum: name=zip state=latest
when: ansible_pkg_mgr == 'yum'
when: ansible_facts.pkg_mgr == 'yum'
- name: Ensure zip is present to create test archive (apt)
apt: name=zip state=latest
when: ansible_pkg_mgr == 'apt'
when: ansible_facts.pkg_mgr == 'apt'
- name: Install prerequisites for backports.lzma when using python2 (non OSX)
block:

View file

@ -9,7 +9,7 @@
- name: Remove all floating IPs created by this test run
cloudscale_floating_ip:
ip: '{{ item.network | ipaddr("address") }}'
ip: '{{ item.network | ansible.netcommon.ipaddr("address") }}'
state: 'absent'
when: cloudscale_resource_prefix in (item.reverse_ptr | string )
with_items: '{{ floating_ip_list.json }}'

View file

@ -28,12 +28,12 @@
- set_fact:
# If netaddr would be installed on the controller, one could do:
nname_3_ipv4_2: "{{ subnet_ipv4 | next_nth_usable(2) }}"
nname_3_ipv4_3: "{{ subnet_ipv4 | next_nth_usable(3) }}"
nname_3_ipv4_4: "{{ subnet_ipv4 | next_nth_usable(4) }}"
nname_3_ipv6_2: "{{ subnet_ipv6 | next_nth_usable(2) }}"
nname_3_ipv6_3: "{{ subnet_ipv6 | next_nth_usable(3) }}"
nname_3_ipv6_4: "{{ subnet_ipv6 | next_nth_usable(4) }}"
nname_3_ipv4_2: "{{ subnet_ipv4 | ansible.netcommon.next_nth_usable(2) }}"
nname_3_ipv4_3: "{{ subnet_ipv4 | ansible.netcommon.next_nth_usable(3) }}"
nname_3_ipv4_4: "{{ subnet_ipv4 | ansible.netcommon.next_nth_usable(4) }}"
nname_3_ipv6_2: "{{ subnet_ipv6 | ansible.netcommon.next_nth_usable(2) }}"
nname_3_ipv6_3: "{{ subnet_ipv6 | ansible.netcommon.next_nth_usable(3) }}"
nname_3_ipv6_4: "{{ subnet_ipv6 | ansible.netcommon.next_nth_usable(4) }}"
- debug:
msg: "Chose random IPv4 subnet {{ subnet_ipv4 }} and random IPv6 subnet {{ subnet_ipv6 }}"
@ -677,44 +677,44 @@
that:
- networks_1 is changed
- networks_1.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv4Address == nname_3_ipv4_2
- networks_1.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ipaddr == nname_3_ipv6_2 | ipaddr
- networks_1.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ansible.netcommon.ipaddr == nname_3_ipv6_2 | ansible.netcommon.ipaddr
- networks_1.container.NetworkSettings.Networks[nname_3].IPAddress == ""
- networks_1.container.NetworkSettings.Networks[nname_3].GlobalIPv6Address == ""
- networks_2 is not changed
- networks_2.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv4Address == nname_3_ipv4_2
- networks_2.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ipaddr == nname_3_ipv6_2 | ipaddr
- networks_2.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ansible.netcommon.ipaddr == nname_3_ipv6_2 | ansible.netcommon.ipaddr
- networks_2.container.NetworkSettings.Networks[nname_3].IPAddress == ""
- networks_2.container.NetworkSettings.Networks[nname_3].GlobalIPv6Address == ""
- networks_3 is changed
- networks_3.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv4Address == nname_3_ipv4_3
- networks_3.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ipaddr == nname_3_ipv6_2 | ipaddr
- networks_3.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ansible.netcommon.ipaddr == nname_3_ipv6_2 | ansible.netcommon.ipaddr
- networks_3.container.NetworkSettings.Networks[nname_3].IPAddress == ""
- networks_3.container.NetworkSettings.Networks[nname_3].GlobalIPv6Address == ""
- networks_4 is changed
- networks_4.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv4Address == nname_3_ipv4_3
- networks_4.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ipaddr == nname_3_ipv6_3 | ipaddr
- networks_4.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ansible.netcommon.ipaddr == nname_3_ipv6_3 | ansible.netcommon.ipaddr
- networks_4.container.NetworkSettings.Networks[nname_3].IPAddress == ""
- networks_4.container.NetworkSettings.Networks[nname_3].GlobalIPv6Address == ""
- networks_5 is changed
- networks_5.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv4Address == nname_3_ipv4_3
- networks_5.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ipaddr == nname_3_ipv6_3 | ipaddr
- networks_5.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ansible.netcommon.ipaddr == nname_3_ipv6_3 | ansible.netcommon.ipaddr
- networks_5.container.NetworkSettings.Networks[nname_3].IPAddress == nname_3_ipv4_3
- networks_5.container.NetworkSettings.Networks[nname_3].GlobalIPv6Address | ipaddr == nname_3_ipv6_3 | ipaddr
- networks_5.container.NetworkSettings.Networks[nname_3].GlobalIPv6Address | ansible.netcommon.ipaddr == nname_3_ipv6_3 | ansible.netcommon.ipaddr
- networks_6 is changed
- networks_6.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv4Address == nname_3_ipv4_4
- networks_6.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ipaddr == nname_3_ipv6_3 | ipaddr
- networks_6.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ansible.netcommon.ipaddr == nname_3_ipv6_3 | ansible.netcommon.ipaddr
- networks_6.container.NetworkSettings.Networks[nname_3].IPAddress == nname_3_ipv4_4
- networks_6.container.NetworkSettings.Networks[nname_3].GlobalIPv6Address | ipaddr == nname_3_ipv6_3 | ipaddr
- networks_6.container.NetworkSettings.Networks[nname_3].GlobalIPv6Address | ansible.netcommon.ipaddr == nname_3_ipv6_3 | ansible.netcommon.ipaddr
- networks_7 is changed
- networks_7.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv4Address == nname_3_ipv4_4
- networks_7.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ipaddr == nname_3_ipv6_4 | ipaddr
- networks_7.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ansible.netcommon.ipaddr == nname_3_ipv6_4 | ansible.netcommon.ipaddr
- networks_7.container.NetworkSettings.Networks[nname_3].IPAddress == nname_3_ipv4_4
- networks_7.container.NetworkSettings.Networks[nname_3].GlobalIPv6Address | ipaddr == nname_3_ipv6_4 | ipaddr
- networks_7.container.NetworkSettings.Networks[nname_3].GlobalIPv6Address | ansible.netcommon.ipaddr == nname_3_ipv6_4 | ansible.netcommon.ipaddr
- networks_8 is not changed
- networks_8.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv4Address == nname_3_ipv4_4
- networks_8.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ipaddr == nname_3_ipv6_4 | ipaddr
- networks_8.container.NetworkSettings.Networks[nname_3].IPAMConfig.IPv6Address | ansible.netcommon.ipaddr == nname_3_ipv6_4 | ansible.netcommon.ipaddr
- networks_8.container.NetworkSettings.Networks[nname_3].IPAddress == nname_3_ipv4_4
- networks_8.container.NetworkSettings.Networks[nname_3].GlobalIPv6Address | ipaddr == nname_3_ipv6_4 | ipaddr
- networks_8.container.NetworkSettings.Networks[nname_3].GlobalIPv6Address | ansible.netcommon.ipaddr == nname_3_ipv6_4 | ansible.netcommon.ipaddr
when: docker_py_version is version('1.10.0', '>=')

View file

@ -19,22 +19,22 @@
# using the apt module prevents autoremove from working, so call apt-get via shell instead
- name: install mercurial (apt)
shell: apt-get -y update && apt-get -y install mercurial
when: ansible_pkg_mgr == 'apt'
when: ansible_facts.pkg_mgr == 'apt'
- name: install mercurial (dnf)
dnf:
name: mercurial
when: ansible_pkg_mgr == 'dnf'
when: ansible_facts.pkg_mgr == 'dnf'
- name: install mercurial (yum)
yum:
name: mercurial
when: ansible_pkg_mgr == 'yum'
when: ansible_facts.pkg_mgr == 'yum'
- name: install mercurial (pkgng)
package:
name: mercurial
when: ansible_pkg_mgr == 'pkgng'
when: ansible_facts.pkg_mgr in ['pkgng', 'community.general.pkgng']
- name: preserve the updated python
command: cp -av "{{ which_python.stdout }}" "{{ which_python.stdout }}.updated"

View file

@ -14,26 +14,26 @@
# using the apt module prevents autoremove from working, so call apt-get via shell instead
- name: uninstall packages which were not originally installed (apt)
shell: apt-get -y remove mercurial && apt-get -y autoremove
when: ansible_pkg_mgr == 'apt'
when: ansible_facts.pkg_mgr == 'apt'
- name: uninstall packages which were not originally installed (dnf)
dnf:
name: mercurial
state: absent
autoremove: yes
when: ansible_pkg_mgr == 'dnf'
when: ansible_facts.pkg_mgr == 'dnf'
# the yum module does not have an autoremove parameter
- name: uninstall packages which were not originally installed (yum)
shell: yum -y autoremove mercurial
when: ansible_pkg_mgr == 'yum'
when: ansible_facts.pkg_mgr == 'yum'
- name: uninstall packages which were not originally installed (pkgng)
package:
name: mercurial
state: absent
autoremove: yes
when: ansible_pkg_mgr == 'pkgng'
when: ansible_facts.pkg_mgr in ['pkgng', 'community.general.pkgng']
- name: restore the default python
raw: mv "{{ which_python.stdout }}.default" "{{ which_python.stdout }}"

View file

View file

@ -13,6 +13,12 @@ pip install openshift -c constraints.txt
./server.py &
cleanup() {
kill -9 "$(jobs -p)"
}
trap cleanup INT TERM EXIT
# Fake auth file
mkdir -p ~/.kube/
cat <<EOF > ~/.kube/config
@ -41,18 +47,17 @@ EOF
#################################################
# run the plugin second
export ANSIBLE_INVENTORY_ENABLED=kubevirt
export ANSIBLE_INVENTORY_ENABLED=community.general.kubevirt
export ANSIBLE_INVENTORY=test.kubevirt.yml
cat << EOF > "$OUTPUT_DIR/test.kubevirt.yml"
plugin: kubevirt
plugin: community.general.kubevirt
connections:
- namespaces:
- default
EOF
ANSIBLE_JINJA2_NATIVE=1 ansible-inventory -vvvv -i "$OUTPUT_DIR/test.kubevirt.yml" --list --output="$OUTPUT_DIR/plugin.out"
kill -9 "$(jobs -p)"
#################################################
# DIFF THE RESULTS

0
tests/integration/targets/inventory_kubevirt/server.py Normal file → Executable file
View file

View file

@ -14,7 +14,7 @@
args:
name: "{{ passwordstore_packages }}"
state: present
when: ansible_facts.pkg_mgr in ['apt', 'dnf', 'yum', 'pkgng']
when: ansible_facts.pkg_mgr in ['apt', 'dnf', 'yum', 'pkgng', 'community.general.pkgng']
- block:
# OpenSUSE Leap>=15.0 don't include password-store in main repo
@ -29,7 +29,7 @@
state: present
update_cache: yes
disable_gpg_check: yes
when: ansible_pkg_mgr == 'zypper'
when: ansible_facts.pkg_mgr in ['zypper', 'community.general.zypper']
- name: Install on macOS
when: ansible_facts.distribution == 'MacOSX'

View file

View file

View file

@ -1,5 +1,5 @@
- name: Install docker 17
zypper:
community.general.zypper:
name: "{{ docker_packages }}"
force: yes
disable_gpg_check: yes

View file

@ -5,7 +5,7 @@
listen: cleanup mysql
- name: remove mysql packages
action: '{{ ansible_pkg_mgr }}'
action: '{{ ansible_facts.pkg_mgr }}'
args:
name: "{{ item }}"
state: absent

View file

@ -45,7 +45,7 @@
yum:
name: "{{ mysql_packages }}"
state: latest
when: ansible_pkg_mgr == 'yum'
when: ansible_facts.pkg_mgr == 'yum'
notify: cleanup mysql
- name: install mysqldb_test rpm dependencies
@ -53,14 +53,14 @@
name: '{{ mysql_packages }}'
state: latest
install_weak_deps: False # mariadb-server has a weak dep on python2 which break Python 3 test environments
when: ansible_pkg_mgr == 'dnf'
when: ansible_facts.pkg_mgr == 'dnf'
notify: cleanup mysql
- name: install mysqldb_test debian dependencies
apt:
name: "{{ mysql_packages }}"
state: latest
when: ansible_pkg_mgr == 'apt'
when: ansible_facts.pkg_mgr == 'apt'
notify: cleanup mysql
- name: install mysqldb_test FreeBSD dependencies

View file

@ -2,3 +2,4 @@ destructive
shippable/posix/group2
skip/python3
skip/aix
disabled #fixme

View file

@ -1,6 +1,4 @@
- name: Gather facts
setup:
---
- name: Install lxml (FreeBSD)
package:
name: '{{ "py27-lxml" if ansible_python.version.major == 2 else "py36-lxml" }}'

View file

@ -0,0 +1,12 @@
Summary: Empty RPM
Name: empty
Version: 1
Release: 0
License: GPLv3
Group: Applications/System
BuildArch: noarch
%description
Empty RPM
%files

View file

@ -9,7 +9,7 @@
- include: 'zypper_repository.yml'
always:
- name: remove repositories added during test
zypper_repository:
community.general.zypper_repository:
name: "{{item}}"
state: absent
with_items:

View file

@ -1,11 +1,11 @@
- name: Delete test repo
zypper_repository:
community.general.zypper_repository:
name: test
state: absent
register: zypper_result
- name: Add test repo
zypper_repository:
community.general.zypper_repository:
name: test
state: present
repo: http://dl.google.com/linux/chrome/rpm/stable/x86_64
@ -17,7 +17,7 @@
- "zypper_result.changed"
- name: Add same repo again
zypper_repository:
community.general.zypper_repository:
name: test
state: present
repo: http://dl.google.com/linux/chrome/rpm/stable/x86_64
@ -29,7 +29,7 @@
- "not zypper_result.changed"
- name: Change repo URL
zypper_repository:
community.general.zypper_repository:
name: test
state: present
repo: http://download.videolan.org/pub/vlc/SuSE/Leap_{{ ansible_distribution_version }}/
@ -41,7 +41,7 @@
- "zypper_result.changed"
- name: use refresh option
zypper_repository:
community.general.zypper_repository:
name: testrefresh
refresh: no
state: present
@ -56,7 +56,7 @@
- '"autorefresh=\"0\"" in zypper_result.stdout'
- name: set repo priority
zypper_repository:
community.general.zypper_repository:
name: testprio
priority: 55
state: present
@ -71,7 +71,7 @@
- '"priority=\"55\"" in zypper_result.stdout'
- name: add two repos with same url
zypper_repository:
community.general.zypper_repository:
name: "{{item}}"
state: present
repo: http://dl.google.com/linux/chrome/rpm/stable/x86_64
@ -96,7 +96,7 @@
- "'http://dl.google.com/linux/chrome/rpm/stable/x86_64' in zypper_result2.stdout"
- name: add two repos with same name
zypper_repository:
community.general.zypper_repository:
name: samename
state: present
repo: "{{ item }}"
@ -114,12 +114,12 @@
- "'/devel:/languages:/ruby/' in zypper_result.stdout"
- name: remove last added repos (by URL to test that)
zypper_repository:
community.general.zypper_repository:
repo: http://download.opensuse.org/repositories/devel:/languages:/ruby/openSUSE_Leap_{{ ansible_distribution_version }}/
state: absent
- name: "Test adding a repo with custom GPG key"
zypper_repository:
community.general.zypper_repository:
name: "Apache_Modules"
repo: "http://download.opensuse.org/repositories/Apache:/Modules/openSUSE_Tumbleweed/"
priority: 100

File diff suppressed because it is too large Load diff

View file

@ -98,6 +98,9 @@ plugins/module_utils/alicloud_ecs.py metaclass-boilerplate
plugins/module_utils/cloud.py future-import-boilerplate
plugins/module_utils/cloud.py metaclass-boilerplate
plugins/module_utils/compat/ipaddress.py future-import-boilerplate
plugins/module_utils/compat/ipaddress.py metaclass-boilerplate
plugins/module_utils/compat/ipaddress.py no-assert
plugins/module_utils/compat/ipaddress.py no-unicode-literals
plugins/module_utils/database.py future-import-boilerplate
plugins/module_utils/database.py metaclass-boilerplate
plugins/module_utils/digital_ocean.py future-import-boilerplate