From da4e5d3592dd83b6a85f5c3c7ed77b1dad8cbcb4 Mon Sep 17 00:00:00 2001 From: Eric Belhomme Date: Tue, 28 Apr 2020 08:51:10 +0200 Subject: [PATCH] fix broken etcd3 module integration test (#239) * fix broken etcd3 module integration test * rewrite etcd3 test role as role-only integration test * etcd3 module integration test changes: - add setup_etcd3 as dependency in meta - skip python2.6 target as etcd3 won't install * fix aliases --- tests/integration/targets/etcd3/aliases | 5 +- .../targets/etcd3/defaults/main.yml | 13 --- tests/integration/targets/etcd3/meta/main.yml | 1 + .../integration/targets/etcd3/tasks/main.yml | 1 + .../targets/etcd3/tasks/run_tests.yml | 86 +------------------ .../targets/etcd3/vars/RedHat-py3.yml | 1 - .../integration/targets/etcd3/vars/RedHat.yml | 3 - tests/integration/targets/etcd3/vars/Suse.yml | 3 - .../targets/etcd3/vars/Ubuntu-16-py3.yml | 1 - .../targets/etcd3/vars/Ubuntu-16.yml | 1 - .../targets/etcd3/vars/default.yml | 1 - 11 files changed, 6 insertions(+), 110 deletions(-) delete mode 100644 tests/integration/targets/etcd3/defaults/main.yml delete mode 100644 tests/integration/targets/etcd3/vars/RedHat-py3.yml delete mode 100644 tests/integration/targets/etcd3/vars/RedHat.yml delete mode 100644 tests/integration/targets/etcd3/vars/Suse.yml delete mode 100644 tests/integration/targets/etcd3/vars/Ubuntu-16-py3.yml delete mode 100644 tests/integration/targets/etcd3/vars/Ubuntu-16.yml delete mode 100644 tests/integration/targets/etcd3/vars/default.yml diff --git a/tests/integration/targets/etcd3/aliases b/tests/integration/targets/etcd3/aliases index a03abe0c05..ce7421e958 100644 --- a/tests/integration/targets/etcd3/aliases +++ b/tests/integration/targets/etcd3/aliases @@ -1,5 +1,6 @@ -destructive shippable/posix/group1 +destructive +skip/aix skip/osx skip/freebsd -disabled +skip/python2.6 # installing etcd3 python module will fail on python < 2.7 \ No newline at end of file diff --git a/tests/integration/targets/etcd3/defaults/main.yml b/tests/integration/targets/etcd3/defaults/main.yml deleted file mode 100644 index bf8934ed75..0000000000 --- a/tests/integration/targets/etcd3/defaults/main.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -# test code for the etcd3 module -# (c) 2017, Jean-Philippe Evrard -# -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# # Copyright: (c) 2018, Ansible Project -# -etcd3_ver: "v3.2.14" -etcd3_download_server: "https://storage.googleapis.com/etcd" -#etcd3_download_server: "https://github.com/coreos/etcd/releases/download" -etcd3_download_url: "{{ etcd3_download_server }}/{{ etcd3_ver }}/etcd-{{ etcd3_ver }}-linux-amd64.tar.gz" -etcd3_download_location: /tmp/etcd-download-test -etcd3_path: "{{ etcd3_download_location }}/etcd-{{ etcd3_ver }}-linux-amd64" diff --git a/tests/integration/targets/etcd3/meta/main.yml b/tests/integration/targets/etcd3/meta/main.yml index 5438ced5c3..48987c5426 100644 --- a/tests/integration/targets/etcd3/meta/main.yml +++ b/tests/integration/targets/etcd3/meta/main.yml @@ -1,2 +1,3 @@ dependencies: - setup_pkg_mgr + - setup_etcd3 diff --git a/tests/integration/targets/etcd3/tasks/main.yml b/tests/integration/targets/etcd3/tasks/main.yml index 99c5013f76..97d279b9d4 100644 --- a/tests/integration/targets/etcd3/tasks/main.yml +++ b/tests/integration/targets/etcd3/tasks/main.yml @@ -19,6 +19,7 @@ # ============================================================ + - name: run_tests for supported distros include_tasks: run_tests.yml when: diff --git a/tests/integration/targets/etcd3/tasks/run_tests.yml b/tests/integration/targets/etcd3/tasks/run_tests.yml index 2095d2d4b8..66b53830bd 100644 --- a/tests/integration/targets/etcd3/tasks/run_tests.yml +++ b/tests/integration/targets/etcd3/tasks/run_tests.yml @@ -1,6 +1,7 @@ --- # test code for the etcd3 module # (c) 2017, Jean-Philippe Evrard +# 2020, SCC France, Eric Belhomme # This file is part of Ansible # @@ -19,86 +20,6 @@ # ============================================================ -- name: python 2 - set_fact: - python_suffix: "" - when: ansible_python_version is version('3', '<') - -- name: python 3 - set_fact: - python_suffix: "-py3" - when: ansible_python_version is version('3', '>=') - -- include_vars: '{{ item }}' - with_first_found: - - files: - - '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}{{ python_suffix }}.yml' - - '{{ ansible_distribution }}-{{ ansible_distribution_version }}{{ python_suffix }}.yml' - - '{{ ansible_os_family }}{{ python_suffix }}.yml' - - 'default{{ python_suffix }}.yml' - paths: '../vars' - -# Install requirements for etcd3 module -- name: Install etcd3 packages - package: - name: "{{ etcd3_deps_packages }}" - state: present - -- name: Install etcd3 module - pip: - name: etcd3 - state: present - -# Check if re-installing etcd3 is required -- name: Check if etcd3ctl exists for re-use. - shell: "ETCDCTL_API=3 {{ etcd3_path }}/etcdctl --endpoints=localhost:2379 get foo" - args: - executable: /bin/bash - changed_when: false - failed_when: false - register: _testetcd3ctl - -# Installing etcd3 -- name: If can't reuse, prepare download folder - file: - path: "{{ etcd3_download_location }}" - state: directory - register: _etcddownloadexists - when: - - _testetcd3ctl.rc != 0 - -- name: Delete download folder if already exists (to start clean) - file: - path: "{{ etcd3_download_location }}" - state: absent - when: - - _testetcd3ctl.rc != 0 - - _etcddownloadexists is not changed - -- name: Recreate download folder if purged - file: - path: "{{ etcd3_download_location }}" - state: directory - when: - - _testetcd3ctl.rc != 0 - - _etcddownloadexists is not changed - -- name: Download etcd3 - unarchive: - src: "{{ etcd3_download_url }}" - dest: "{{ etcd3_download_location }}" - remote_src: yes - when: - - _testetcd3ctl.rc != 0 - -# Running etcd3 and kill afterwards if it wasn't running before. -- name: Run etcd3 - shell: "{{ etcd3_path }}/etcd &" - register: _etcd3run - changed_when: true - when: - - _testetcd3ctl.rc != 0 - # Integration tests - name: Check mode, show need change etcd3: @@ -171,8 +92,3 @@ - _etcd3_absnt_chgtst is changed - _etcd3_absnt_idmptnttst is not changed - _etcd3_absnt_idmptntchktst is not changed - -- name: kill etcd3 - command: "pkill etcd" - when: - - _testetcd3ctl.rc != 0 diff --git a/tests/integration/targets/etcd3/vars/RedHat-py3.yml b/tests/integration/targets/etcd3/vars/RedHat-py3.yml deleted file mode 100644 index 6337a87307..0000000000 --- a/tests/integration/targets/etcd3/vars/RedHat-py3.yml +++ /dev/null @@ -1 +0,0 @@ -etcd3_deps_packages: [] diff --git a/tests/integration/targets/etcd3/vars/RedHat.yml b/tests/integration/targets/etcd3/vars/RedHat.yml deleted file mode 100644 index 8eda206015..0000000000 --- a/tests/integration/targets/etcd3/vars/RedHat.yml +++ /dev/null @@ -1,3 +0,0 @@ -etcd3_deps_packages: - - gcc-c++ - - python-devel diff --git a/tests/integration/targets/etcd3/vars/Suse.yml b/tests/integration/targets/etcd3/vars/Suse.yml deleted file mode 100644 index 8eda206015..0000000000 --- a/tests/integration/targets/etcd3/vars/Suse.yml +++ /dev/null @@ -1,3 +0,0 @@ -etcd3_deps_packages: - - gcc-c++ - - python-devel diff --git a/tests/integration/targets/etcd3/vars/Ubuntu-16-py3.yml b/tests/integration/targets/etcd3/vars/Ubuntu-16-py3.yml deleted file mode 100644 index 6337a87307..0000000000 --- a/tests/integration/targets/etcd3/vars/Ubuntu-16-py3.yml +++ /dev/null @@ -1 +0,0 @@ -etcd3_deps_packages: [] diff --git a/tests/integration/targets/etcd3/vars/Ubuntu-16.yml b/tests/integration/targets/etcd3/vars/Ubuntu-16.yml deleted file mode 100644 index 6337a87307..0000000000 --- a/tests/integration/targets/etcd3/vars/Ubuntu-16.yml +++ /dev/null @@ -1 +0,0 @@ -etcd3_deps_packages: [] diff --git a/tests/integration/targets/etcd3/vars/default.yml b/tests/integration/targets/etcd3/vars/default.yml deleted file mode 100644 index 6337a87307..0000000000 --- a/tests/integration/targets/etcd3/vars/default.yml +++ /dev/null @@ -1 +0,0 @@ -etcd3_deps_packages: []