mirror of https://github.com/ansible/ansible.git
Incidental coverage 1 (#77846)
* Add find test to assert patterns with regex * Add test to assert that nested includes with relative path work * Add test to assert symmetric_difference supports unhashable types * ci_complete ci_coverage * Add test to assert JSON values are converted to Python * Add test to assert how unexpected module failures behave * Add test to verify remote_is_local * ci_complete ci_coverage * Get real path of local tmp * ci_complete ci_coverage * Expanded symmetric_difference tests * ci_complete ci_coverage * I don't even know * ci_complete ci_coverage * Revert mathstuff changes * ci_complete ci_coveragepull/77916/head
parent
f7d7604454
commit
e7e1d592a6
@ -0,0 +1,2 @@
|
||||
shippable/posix/group3
|
||||
context/controller
|
@ -0,0 +1,25 @@
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
name: remote_is_local
|
||||
short_description: remote is local
|
||||
description:
|
||||
- remote_is_local
|
||||
author: ansible (@core)
|
||||
version_added: historical
|
||||
extends_documentation_fragment:
|
||||
- connection_pipelining
|
||||
notes:
|
||||
- The remote user is ignored, the user with which the ansible CLI was executed is used instead.
|
||||
'''
|
||||
|
||||
|
||||
from ansible.plugins.connection.local import Connection as LocalConnection
|
||||
|
||||
|
||||
class Connection(LocalConnection):
|
||||
_remote_is_local = True
|
@ -0,0 +1,15 @@
|
||||
- command: ansible-playbook {{ role_path }}/test.yml -vvv -i {{ '-i '.join(ansible_inventory_sources) }}
|
||||
environment:
|
||||
ANSIBLE_REMOTE_TEMP: /i/dont/exist
|
||||
ANSIBLE_NOCOLOR: 'true'
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- >-
|
||||
result.stdout is search('PUT ' ~ ansible_local ~ ' TO ' ~ ansible_local)
|
||||
- >-
|
||||
'/i/dont/exist' not in result.stdout
|
||||
vars:
|
||||
local_tmp: '{{ q("config", "remote_tmp", plugin_type="shell", plugin_name="sh")|first|expanduser|realpath }}'
|
||||
ansible_local: '{{ local_tmp }}/ansible-local-\S+'
|
@ -0,0 +1,8 @@
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- ping:
|
||||
vars:
|
||||
ansible_connection: remote_is_local
|
||||
ansible_pipelining: false
|
||||
ansible_remote_tmp: /i/dont/exist
|
@ -0,0 +1,2 @@
|
||||
shippable/posix/group5
|
||||
context/controller
|
@ -0,0 +1,11 @@
|
||||
- include_tasks: nested/nested_include.yml
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- nested_adjacent_count|int == 1
|
||||
|
||||
- import_tasks: nested/nested_import.yml
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- nested_adjacent_count|int == 2
|
@ -0,0 +1,2 @@
|
||||
- set_fact:
|
||||
nested_adjacent_count: '{{ nested_adjacent_count|default(0)|int + 1 }}'
|
@ -0,0 +1 @@
|
||||
- import_tasks: nested_adjacent.yml
|
@ -0,0 +1 @@
|
||||
- include_tasks: nested_adjacent.yml
|
@ -0,0 +1,8 @@
|
||||
from ansible.plugins.action import ActionBase
|
||||
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
TRANSFERS_FILES = False
|
||||
|
||||
def run(self, tmp=None, task_vars=None):
|
||||
raise Exception('boom')
|
@ -0,0 +1,2 @@
|
||||
shippable/posix/group3
|
||||
context/controller
|
@ -0,0 +1,7 @@
|
||||
- unexpected:
|
||||
register: result
|
||||
ignore_errors: true
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.msg == "Unexpected failure during module execution: boom"'
|
Loading…
Reference in New Issue