summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2015-05-14 14:21:29 -0700
committerToshio Kuratomi <toshio@fedoraproject.org>2015-05-14 14:21:29 -0700
commit0f9ad9dad2db3ea6c9b8fe6f35844a1e22fbf721 (patch)
tree2dcacd0df456d841423391ec194c5771878fe8d2
parent3383a7b37aa6aa1697369233d58182614636b453 (diff)
downloadansible-uri-integration.tar.gz
Update integration tests from @darkk to work with the current uri module codeuri-integration
-rw-r--r--test/integration/non_destructive.yml1
-rw-r--r--test/integration/roles/test_uri/tasks/main.yml86
2 files changed, 28 insertions, 59 deletions
diff --git a/test/integration/non_destructive.yml b/test/integration/non_destructive.yml
index e520a17ea0..0c4c5be496 100644
--- a/test/integration/non_destructive.yml
+++ b/test/integration/non_destructive.yml
@@ -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 }
diff --git a/test/integration/roles/test_uri/tasks/main.yml b/test/integration/roles/test_uri/tasks/main.yml
index c41590636d..6072754f22 100644
--- a/test/integration/roles/test_uri/tasks/main.yml
+++ b/test/integration/roles/test_uri/tasks/main.yml
@@ -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 }}'