Commit Graph

491 Commits (8cda5f55375e3c5caa77d900d1bfa90c5fea0094)

Author SHA1 Message Date
Alex Willmer f1503874de ansible_mitogen: Correct ansible_become_pass/ansible_become_password precendence
Until Ansible 2.9 it looks like ansible_become_password had higher priority.
From Ansible 2.10 ansible_become_pass has higher priority [1]. Mitogen was not
respecting this.

I may need to rework this further, instatiating the become plugin may have
slowed down execution.

[1] Based on testing with

```
[ubuntus]
become-pass-pass ansible_become_pass=1234
become-pass-password ansible_become_password=1234
become-pass-both ansible_become_password=wrong ansible_become_pass=1234

[ubuntus:vars]
ansible_host=ubuntu2004.local
ansible_user=ubuntu
```
```
- hosts: ubuntus
  gather_facts: false
  become: true
  tasks:
    - ping:
```
2 years ago
Alex Willmer e36bbde9ac tests: Replace uses of assertTrue() with specific methods 2 years ago
Alex Willmer 64819ecb5f tests: Regression test for #776 (package/yum/dnf module called twice) 2 years ago
Alex Willmer 24c845379a tests: Remove redundant regression tags
The tag is applied by the playbook that imports this one.
2 years ago
Alex Willmer db0ffae352 tests: Enable stricter error handling, fix resulting failures 2 years ago
Alex Willmer 216e7c9150 tests: Correct Ansible targets 2 years ago
Alex Willmer 8e79488768 tests: Mark or avoid sudo tasks on localhost 2 years ago
Alex Willmer f070767dad tests: Use meaningful play names 2 years ago
Felix Stupp b1e67cc7df tests/ansible/README: Replace reference with actual link
- working for GitHub and similar Markdown engines
2 years ago
Alex Willmer 25ea6dde02 ansible_mitogen: Allow mitogen_fetch to bypass slurp module
This reapplies an earlier change, when this plugin was first introduced to
Mitogen. The plugin was updated to fix

[DEPRECATION WARNING]: The '_remote_checksum()' method is deprecated.

I've elected to short-circuit the if statemtn logic, rather than
deleting/unindenting, to make the code delta much smaller. This should make it
easier to maintain/update.

Fixes #915
2 years ago
Alex Willmer 18c89de5a9 Remove unused module imports 2 years ago
Alex Willmer db9e52ce8e tests: Run containers on macOS with podman, instead of Docker 2 years ago
Alex Willmer 1287d58a54 Use with open(): ... to ensure file objects get closed 2 years ago
Alex Willmer caa20be43e tests: Use TestCase.assertEqual()
assertEquals() is deperecated in unittest
2 years ago
Alex Willmer a8317c2393 tests: Remove unittest2, use stdlib unittest
unittest2 is incomplatible with Python 3.10
2 years ago
Alex Willmer 5805e30232 tests: Remove unused imports 2 years ago
Klaus Zerwes f1fde91984 Revert "Revert "fixed tests for ansible 2.12""
This reverts commit ffb58cd557.
3 years ago
Klaus Zerwes 2b4f04c554 Revert "Revert "fixed tests for ansible 2.12""
This reverts commit 478f286efb.
3 years ago
Klaus Zerwes b8dd348b1e Revert "Revert "fixed tests for ansible 2.12""
This reverts commit f82bd3d714.
3 years ago
Klaus Zerwes 81f075340b use conditionals in list form 3 years ago
Klaus Zerwes ffb58cd557 Revert "fixed tests for ansible 2.12"
include is deprecated and will be removed in 2.16, so there is some time to fix this left
This reverts commit 19c28b2b1a.
3 years ago
Klaus Zerwes f82bd3d714 Revert "fixed tests for ansible 2.12"
include is deprecated and will be removed in 2.16, so there is some time to fix this left
This reverts commit 7bc2102d2b.
3 years ago
Klaus Zerwes 478f286efb Revert "fixed tests for ansible 2.12"
include is deprecated and will be removed in 2.16, so there is some time to fix this left
This reverts commit 2d3970552e.
3 years ago
Klaus Zerwes e509c1fb77
Update tests/ansible/integration/interpreter_discovery/ansible_2_8_tests.yml
Co-authored-by: Alex Willmer <alex@moreati.org.uk>
3 years ago
Klaus Zerwes 3d450f0f22 fix interpreter discovery tests for changed python interpreter behaviour from ansible 2.12 on 3 years ago
Klaus Zerwes 2d3970552e fixed tests for ansible 2.12 3 years ago
Klaus Zerwes 7bc2102d2b fixed tests for ansible 2.12 3 years ago
Klaus Zerwes 19c28b2b1a fixed tests for ansible 2.12 3 years ago
Alex Willmer d9b8d50d4e Fix ansible.__version__ comparisons with multi-digit components
Ansible 2.8 is older than Ansible 2.10, but `'2.8' < '2.10' == False`
3 years ago
Alex Willmer e194a6367f ci: Fix version comparisons involving double digits
See https://gist.github.com/moreati/e7507c5b606b12ec0ddafcb7c8debbf1
3 years ago
Alex Willmer c61c063b4f Support for Ansible 3 & 4
fixes #834

Co-authored-by: Claude Becker (@upekkha)
Co-authored-by: Dolph Mathews (@dolph)
3 years ago
Alex Willmer 1bdf6294e4 ci: Print playbook role execution times 3 years ago
Alex Willmer 9201761348 ci: Format ansible-playbook output as yaml 3 years ago
Alex Willmer 3c58215a91 tests: Tag Ansible tests
This makes it easier to run subsets using ANSIBLE_RUN_TAGS=...
3 years ago
Alex Willmer 147a716b28 CI: Handle NameError traceback on stdout in Ansible 2.10+ 3 years ago
Alex Willmer 2b27384a93 CI: Handle variant of unknown user error message seen on MacOS 3 years ago
Alex Willmer 5fc7fcd112 CI: Skip unprivileged become tests on MacOS with Ansible < 2.11
Ansible 2.10 and earlier try to use setfacl, which is not present on
MacOS. Ansible 2.11 and later use chmod +a instead.
3 years ago
Dolph Mathews bd086fd519 fix mac build failure
(cherry picked from commit 40b603e098)
3 years ago
Alex Willmer b65b6ae88f
Merge branch 'master' into multi-word-mask 3 years ago
Alex Willmer cfa5888547 tests: Print variables on failure of assert tasks
Fixes #852
3 years ago
Stefano Rivera b672eafcb0 Support multi-word cpusets
From cpuset(7):

> For masks longer than one word, a comma separator is used between
> words. Words are displayed in big-endian order, which has the most
> significant bit first. The hex digits within a word are also in
> big-endian order.
3 years ago
Stefano Rivera 184ff0f507 Skip test_unwriteable when tests are run as root
Writes by root ignore fs permissions, so this test will fail when run as root.
3 years ago
Alex Willmer ac7505d624 tests: Add centos 8; debian 10, 11; ubuntu 16.04, 18.04, 20.04 test images 3 years ago
Alex Willmer a8e8cf91cb tests: Rebuild Docker containers
A few changes are bundled in this
 - Ansible 2.10.x and Mitogen 0.3.x are used to build nearly all images
   (Ansile 2.3.x is retained for CentOS 5, because it uses Python 2.4).
 - Tox is used to install/run Ansible, replacing build_docker_images.py
 - A static inventory, identifying containers by name rather than ID.
 - debian-test image is renamed to debian9-test
 - debian9-test image is now based on debian:9
 - centos6-test image is now based on moreati/centos6-vault
   following the same scheme as centos5-test.
 - Images are now uploaded to Amazon Elastic Container Registry (ECR).
   See #809.
 - Debian recommended packages aren't installed (e.g. build-essential)
 - Python 2.x and Python 3.x are installed wherever available.
 - Python Virtualenv is installed wherever available.
3 years ago
Alex Willmer 1e72ebaf8b tests: Update test coverage to Python 3.9
The Travis Linux distribution must be upgraded because the Trusty
(Ubuntu 14.04) image does not have Python 3.9. Xenial (Ubuntu 16.04) is
the earliest version that offers Python 3.9.

I have not chosen a later release, in order to aid restoration of Python
2.4 - 2.6 tests.
3 years ago
Alex Willmer 1a0951c664
Merge branch 'master' into tests-resource_intensive-tag 3 years ago
Alex Willmer bb271d8d00 tests: Tag resource intensive tasks, to skip when strategy=linear
The ansible_mitogen test suite takes over an hour when Ansible is not
accelerated by Mitogen. This change aims to reduce that by skipping
tests with a large number of iterations when the linear strategy is
chosen.

The tagged tests are intended to uncover Mitogen resource leaks. Since
Mitogen is not invoked when strategy=linear, the slight reduction in
test coverage is an acceptable trade off.
3 years ago
Alex Willmer a64e966ab9 tests: Add unofficial Tox environments for Ansible tests
These are not part of the official testing regime (tests run for pull
requests). I find them convenient for local development.

Limitations
- Python 2.7+ only. No Python 2.4, 2.5, or 2.6.
- Requires Pythons pre-installed (e.g. DeadSnakes, pyenv)
- No coverage of alternate controller OS (e.g. MacOS)

The environments tested by default are

py27-mode_ansible-ansible2.10
py36-mode_ansible-ansible2.10
py39-mode_ansible-ansible2.10
py27-mode_mitogen
py36-mode_mitogen
py39-mode_mitogen
py27-mode_mitogen-distro_centos7
py36-mode_mitogen-distro_centos7
py39-mode_mitogen-distro_centos7
4 years ago
Steven Robertson 22cce2dfae Merge branch 'master' into collectionsSupport 4 years ago
Alex Willmer 79b4c0f815 tests: Fix AttributeError in callback plugins used by test suite
CALLBACK_VERSION et al are documented as required in
https://docs.ansible.com/ansible/2.10/dev_guide/developing_plugins.html#callback-plugins.
The need for document_fragment is noted in
cfa8075537/lib/ansible/plugins/callback/default.py (L28-L32)

Fixes #758

This addresses the following error, seen while running
`ansible_tests.py`.

```
TASK [Gathering Facts gather_timeout=10, gather_subset=['all']]
****************
task path:
/home/alex/src/mitogen/tests/ansible/regression/issue_109__target_has_old_ansible_installed.yml:4
[WARNING]: Failure using method (v2_runner_on_start) in callback plugin
(<ansible.plugins.callback.nice_stdout.CallbackModule object at
0x7f76b3dad090>): 'show_per_host_start'
Callback Exception:
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py",
line 372, in send_callback
    method(*new_args, **kwargs)
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/plugins/callback/default.py",
line 240, in v2_runner_on_start
    if self.get_option('show_per_host_start'):
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/plugins/callback/__init__.py",
line 91, in get_option
    return self._plugin_options[k]
Callback Exception:
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py",
line 372, in send_callback
    method(*new_args, **kwargs)
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/plugins/callback/default.py",
line 240, in v2_runner_on_start
    if self.get_option('show_per_host_start'):
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/plugins/callback/__init__.py",
line 91, in get_option
    return self._plugin_options[k]
[task 339882] 00:00:08.172036 D ansible_mitogen.affinity: CPU mask for
WorkerProcess: 0x000004
Callback Exception:
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py",
line 372, in send_callback
    method(*new_args, **kwargs)
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/plugins/callback/default.py",
line 240, in v2_runner_on_start
    if self.get_option('show_per_host_start'):
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/plugins/callback/__init__.py",
line 91, in get_option
    return self._plugin_options[k]
```
4 years ago