Update integration tests from @darkk to work with the current uri module code
This commit is contained in:
parent
3383a7b37a
commit
0f9ad9dad2
2 changed files with 28 additions and 59 deletions
|
@ -39,6 +39,7 @@
|
|||
- { role: test_authorized_key, tags: test_authorized_key }
|
||||
- { role: test_get_url, tags: test_get_url }
|
||||
- { role: test_embedded_module, tags: test_embedded_module }
|
||||
- { role: test_uri, tags: test_uri }
|
||||
# Turn on test_binary when we start testing v2
|
||||
#- { role: test_binary, tags: test_binary }
|
||||
|
||||
|
|
|
@ -19,24 +19,39 @@
|
|||
- name: set role facts
|
||||
set_fact:
|
||||
http_port: 15260
|
||||
files_dir: '{{ _original_file|dirname }}/../files'
|
||||
files_dir: '{{ output_dir|expanduser }}/files'
|
||||
checkout_dir: '{{ output_dir }}/git'
|
||||
|
||||
- name: create a directory to serve files from
|
||||
file:
|
||||
dest: "{{ files_dir }}"
|
||||
state: directory
|
||||
|
||||
- copy:
|
||||
src: "{{ item }}"
|
||||
dest: "{{files_dir}}/{{ item }}"
|
||||
with_sequence: start=0 end=4 format=pass%d.json
|
||||
|
||||
- copy:
|
||||
src: "{{ item }}"
|
||||
dest: "{{files_dir}}/{{ item }}"
|
||||
with_sequence: start=0 end=30 format=fail%d.json
|
||||
|
||||
- name: verify that python2 is installed so this test can continue
|
||||
shell: which python2
|
||||
register: py2
|
||||
|
||||
- name: start SimpleHTTPServer
|
||||
shell: cd {{ files_dir }} && {{ py2.stdout }} -m SimpleHTTPServer {{ http_port }}
|
||||
async: 15 # this test set takes ~8 seconds to run
|
||||
async: 60 # this test set takes ~15 seconds to run
|
||||
poll: 0
|
||||
|
||||
- wait_for: port={{ http_port }}
|
||||
|
||||
|
||||
- name: md5 pass_json
|
||||
stat: path={{ files_dir }}/{{ item }}.json get_md5=yes
|
||||
register: pass_md5
|
||||
- name: checksum pass_json
|
||||
stat: path={{ files_dir }}/{{ item }}.json get_checksum=yes
|
||||
register: pass_checksum
|
||||
with_sequence: start=0 end=4 format=pass%d
|
||||
|
||||
- name: fetch pass_json
|
||||
|
@ -48,15 +63,15 @@
|
|||
assert:
|
||||
that:
|
||||
- '"json" in item.1'
|
||||
- item.0.stat.md5 == item.1.raw_content | md5
|
||||
- item.0.stat.checksum == item.1.content | checksum
|
||||
with_together:
|
||||
- pass_md5.results
|
||||
- pass_checksum.results
|
||||
- pass.results
|
||||
|
||||
|
||||
- name: md5 fail_json
|
||||
stat: path={{ files_dir }}/{{ item }}.json get_md5=yes
|
||||
register: fail_md5
|
||||
- name: checksum fail_json
|
||||
stat: path={{ files_dir }}/{{ item }}.json get_checksum=yes
|
||||
register: fail_checksum
|
||||
with_sequence: start=0 end=30 format=fail%d
|
||||
|
||||
- name: fetch fail_json
|
||||
|
@ -67,55 +82,8 @@
|
|||
- name: check fail_json
|
||||
assert:
|
||||
that:
|
||||
- item.0.stat.md5 == item.1.raw_content | md5
|
||||
- item.0.stat.checksum == item.1.content | checksum
|
||||
- '"json" not in item.1'
|
||||
with_together:
|
||||
- fail_md5.results
|
||||
- fail_checksum.results
|
||||
- fail.results
|
||||
|
||||
|
||||
- name: check content != raw_content
|
||||
assert:
|
||||
that: item.content != item.raw_content
|
||||
with_items:
|
||||
- '{{ pass.results.0 }}'
|
||||
- '{{ fail.results.14 }}'
|
||||
- '{{ fail.results.15 }}'
|
||||
- '{{ fail.results.16 }}'
|
||||
- '{{ fail.results.27 }}'
|
||||
|
||||
- name: check content == raw_content
|
||||
assert:
|
||||
that: item.content == item.raw_content
|
||||
with_items:
|
||||
- '{{ pass.results.1 }}'
|
||||
- '{{ pass.results.2 }}'
|
||||
- '{{ pass.results.3 }}'
|
||||
- '{{ pass.results.4 }}'
|
||||
- '{{ fail.results.0 }}'
|
||||
- '{{ fail.results.1 }}'
|
||||
- '{{ fail.results.2 }}'
|
||||
- '{{ fail.results.3 }}'
|
||||
- '{{ fail.results.4 }}'
|
||||
- '{{ fail.results.5 }}'
|
||||
- '{{ fail.results.6 }}'
|
||||
- '{{ fail.results.7 }}'
|
||||
- '{{ fail.results.8 }}'
|
||||
- '{{ fail.results.9 }}'
|
||||
- '{{ fail.results.10 }}'
|
||||
- '{{ fail.results.11 }}'
|
||||
- '{{ fail.results.12 }}'
|
||||
- '{{ fail.results.13 }}'
|
||||
- '{{ fail.results.17 }}'
|
||||
- '{{ fail.results.18 }}'
|
||||
- '{{ fail.results.19 }}'
|
||||
- '{{ fail.results.20 }}'
|
||||
- '{{ fail.results.21 }}'
|
||||
- '{{ fail.results.22 }}'
|
||||
- '{{ fail.results.23 }}'
|
||||
- '{{ fail.results.24 }}'
|
||||
- '{{ fail.results.25 }}'
|
||||
- '{{ fail.results.26 }}'
|
||||
- '{{ fail.results.28 }}'
|
||||
- '{{ fail.results.29 }}'
|
||||
- '{{ fail.results.30 }}'
|
||||
|
|
Loading…
Reference in a new issue