"examples": start adding structure to regression tests.

pull/193/head
David Wilson 6 years ago
parent 95ca29262a
commit 047458a8b3

@ -185,6 +185,9 @@ class ScriptPlanner(BinaryPlanner):
detection and rewrite. detection and rewrite.
""" """
def _rewrite_interpreter(self, interpreter, task_vars, templar): def _rewrite_interpreter(self, interpreter, task_vars, templar):
if interpreter is None:
return None
key = u'ansible_%s_interpreter' % os.path.basename(interpreter).strip() key = u'ansible_%s_interpreter' % os.path.basename(interpreter).strip()
try: try:
return templar.template(task_vars[key].strip()) return templar.template(task_vars[key].strip())

@ -1,2 +1,2 @@
modules/binary_producing_junk modules/custom_binary_producing_junk
modules/binary_producing_json modules/custom_binary_producing_json

@ -1,4 +1,4 @@
all: \ all: \
modules/binary_producing_junk \ modules/custom_binary_producing_junk \
modules/binary_producing_json modules/custom_binary_producing_json

@ -1,11 +1,7 @@
---
# Verify the behaviour of _low_level_execute_command(). # Verify the behaviour of _low_level_execute_command().
- hosts: all - hosts: all
gather_facts: false
tasks: tasks:
# "echo -en" to test we actually hit bash shell too. # "echo -en" to test we actually hit bash shell too.
- name: Run raw module without sudo - name: Run raw module without sudo
raw: 'echo -en $((1 + 1))' raw: 'echo -en $((1 + 1))'

@ -1,7 +1,8 @@
[defaults] [defaults]
inventory = hosts inventory = hosts
gathering = explicit
strategy_plugins = ../../ansible_mitogen/plugins/strategy strategy_plugins = ../../ansible_mitogen/plugins/strategy
strategy = mitogen_linear #strategy = mitogen_linear
library = modules library = modules
retry_files_enabled = False retry_files_enabled = False
forks = 50 forks = 50

@ -1,9 +1,5 @@
---
- hosts: all - hosts: all
gather_facts: false
tasks: tasks:
- name: simulate long running op (3 sec), wait for up to 5 sec, poll every 1 sec - name: simulate long running op (3 sec), wait for up to 5 sec, poll every 1 sec
command: /bin/sleep 2 command: /bin/sleep 2
async: 4 async: 4

@ -1,8 +1,5 @@
---
# Reproduction for issue #109. # Reproduction for issue #109.
- hosts: all - hosts: all
roles: roles:
- issue_109 - issue_109
gather_facts: no

@ -1,7 +1,4 @@
---
- hosts: all - hosts: all
gather_facts: false
tasks: tasks:
- name: Get auth token - name: Get auth token

@ -1,5 +1,3 @@
---
# issue #118 repro: chmod +x not happening during script upload # issue #118 repro: chmod +x not happening during script upload
# #
- name: saytrue - name: saytrue

@ -1,4 +1,3 @@
- hosts: all - hosts: all
tasks: tasks:
- script: scripts/print_env.sh - script: scripts/print_env.sh

@ -1,13 +1,9 @@
---
# Hopeful reproduction for issue #131. # Hopeful reproduction for issue #131.
# Run lots of steps (rather than just one) so WorkerProcess and suchlike # Run lots of steps (rather than just one) so WorkerProcess and suchlike
# machinery is constantly recreated. # machinery is constantly recreated.
- hosts: all - hosts: all
gather_facts: no
tasks: tasks:
- shell: "true" - shell: "true"
- shell: "true" - shell: "true"
- shell: "true" - shell: "true"
@ -58,4 +54,3 @@
- shell: "true" - shell: "true"
- shell: "true" - shell: "true"
- shell: "true" - shell: "true"

@ -1,11 +1,7 @@
---
# Reproduction for issue #140. # Reproduction for issue #140.
- hosts: all - hosts: all
gather_facts: no
tasks: tasks:
- name: Create file tree - name: Create file tree
connection: local connection: local
shell: > shell: >
@ -26,4 +22,3 @@
with_filetree: with_filetree:
- filetree - filetree
when: item.state == 'file' when: item.state == 'file'

@ -1,8 +1,5 @@
- hosts: all - hosts: all
tasks: tasks:
- name: Make virtualenv - name: Make virtualenv
pip: pip:
virtualenv: /tmp/issue_151_virtualenv virtualenv: /tmp/issue_151_virtualenv

@ -1,4 +1,3 @@
# issue #152 (b): local connections were not receiving # issue #152 (b): local connections were not receiving
# ansible_python_interpreter treatment, breaking virtualenvs. # ansible_python_interpreter treatment, breaking virtualenvs.
@ -9,7 +8,5 @@
# - Run ansible-playbook ... with the virtualenv activated. Observe success. # - Run ansible-playbook ... with the virtualenv activated. Observe success.
- hosts: all - hosts: all
gather_facts: false
tasks: tasks:
- local_action: cloudformation_facts - local_action: cloudformation_facts

@ -1,6 +1,4 @@
- hosts: all - hosts: all
gather_facts: no
become: true become: true
vars: vars:
repo_baseurl: "http://myurl.com" repo_baseurl: "http://myurl.com"
@ -11,7 +9,6 @@
- repo: demo-repo2 - repo: demo-repo2
description: Misc packages description: Misc packages
url: "{{repo_baseurl}}/repo2" url: "{{repo_baseurl}}/repo2"
tasks: tasks:
- name: Create multiple yum repos - name: Create multiple yum repos
yum_repository: yum_repository:

@ -1,9 +1,5 @@
---
- hosts: all - hosts: all
gather_facts: false
tasks: tasks:
- name: add nginx ppa - name: add nginx ppa
become: yes become: yes
apt_repository: repo='ppa:nginx/stable' update_cache=yes apt_repository: repo='ppa:nginx/stable' update_cache=yes

@ -1,11 +1,7 @@
- hosts: all - hosts: all
gather_facts: false
tasks: tasks:
- name: copy repo configs - name: copy repo configs
copy: src=/etc/{{ item }} dest=/tmp/{{item}} mode=0644 copy: src=/etc/{{ item }} dest=/tmp/{{item}} mode=0644
with_items: with_items:
- passwd - passwd
- hosts - hosts

@ -1,5 +0,0 @@
#!/bin/bash
exec >/tmp/derp
echo "$1"
cat "$1"

@ -4,13 +4,13 @@
INPUT=$1 INPUT=$1
[ ! -r "$INPUT" ] && { [ ! -r "$INPUT" ] && {
echo "Usage: $0 <input.json>" >&2 echo "Usage: $0 <input_file>" >&2
exit 1 exit 1
} }
echo "{" echo "{"
echo " \"changed\": false," echo " \"changed\": false,"
echo " \"msg\": \"Here is my input\"," echo " \"msg\": \"Here is my input\","
echo " \"filname\": \"$INPUT\"," echo " \"filename\": \"$INPUT\","
echo " \"input\": [\"$(cat $INPUT | tr \" \' )\"]" echo " \"input\": [\"$(cat $INPUT | tr \" \' )\"]"
echo "}" echo "}"

@ -1,6 +0,0 @@
---
- hosts: all
gather_facts: false
tasks:
- bin_bash_module:

@ -0,0 +1,27 @@
# This must be run with FOO=2 set in the environment.
#
# Test sudo_flags respects -E.
#
- hosts: all
tasks:
- name: "without -E"
become: true
shell: "echo $FOO"
register: out
- assert:
that: "out.stdout == ''"
- hosts: all
become_flags: -E
tasks:
- name: "with -E"
become: true
shell: "set"
register: out2
- debug: msg={{out2}}
- assert:
that: "out2.stdout == '2'"

@ -1,9 +1,5 @@
---
- hosts: all - hosts: all
gather_facts: false
tasks: tasks:
# #
# delegate_to, no sudo # delegate_to, no sudo
# #

@ -1,10 +1,7 @@
---
# Ensure environment: is preserved during call. # Ensure environment: is preserved during call.
- hosts: all - hosts: all
gather_facts: false
tasks: tasks:
- shell: echo $SOME_ENV - shell: echo $SOME_ENV
environment: environment:
SOME_ENV: 123 SOME_ENV: 123
@ -14,4 +11,3 @@
- assert: - assert:
that: "result.stdout == '123'" that: "result.stdout == '123'"

@ -0,0 +1,9 @@
- import_playbook: runner__builtin_command_module.yml
- import_playbook: runner__custom_bash_old_style_module.yml
- import_playbook: runner__custom_bash_want_json_module.yml
- import_playbook: runner__custom_binary_producing_json.yml
- import_playbook: runner__custom_binary_producing_junk.yml
- import_playbook: runner__custom_binary_single_null.yml
- import_playbook: runner__custom_python_json_args_module.yml
- import_playbook: runner__custom_python_new_style_module.yml
- import_playbook: runner__custom_python_want_json_module.yml

@ -1,8 +1,5 @@
---
- hosts: all - hosts: all
gather_facts: false
tasks: tasks:
- name: "Run hostname" - name: "Run hostname"
command: hostname command: hostname
with_sequence: start=1 end=100 with_sequence: start=1 end={{end|default(100)}}

@ -0,0 +1,5 @@
- hosts: all
tasks:
- custom_bash_old_style_module:
foo: true
with_sequence: start=1 end={{end|default(100)}}

@ -0,0 +1,5 @@
- hosts: all
tasks:
- custom_bash_want_json_module:
foo: true
with_sequence: start=1 end={{end|default(100)}}

@ -0,0 +1,5 @@
- hosts: all
tasks:
- custom_binary_producing_json:
foo: true
with_sequence: start=1 end={{end|default(100)}}

@ -0,0 +1,6 @@
- hosts: all
tasks:
- custom_binary_producing_junk:
foo: true
with_sequence: start=1 end={{end|default(100)}}
ignore_errors: true

@ -0,0 +1,6 @@
- hosts: all
tasks:
- custom_binary_single_null:
foo: true
with_sequence: start=1 end={{end|default(100)}}
ignore_errors: true

@ -0,0 +1,5 @@
- hosts: all
tasks:
- custom_python_json_args_module:
foo: true
with_sequence: start=1 end={{end|default(100)}}

@ -0,0 +1,5 @@
- hosts: all
tasks:
- custom_python_new_style_module:
foo: true
with_sequence: start=1 end={{end|default(100)}}

@ -0,0 +1,5 @@
- hosts: all
tasks:
- custom_python_want_json_module:
foo: true
with_sequence: start=1 end={{end|default(100)}}
Loading…
Cancel
Save