Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
13578738
Commit
13578738
authored
May 20, 2015
by
Toshio Kuratomi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11014 from ansible/uri-integration
Uri integration tests
parents
f90ea8a3
0f9ad9da
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
236 additions
and
0 deletions
+236
-0
test/integration/non_destructive.yml
+1
-0
test/integration/roles/test_uri/files/README
+9
-0
test/integration/roles/test_uri/files/fail0.json
+2
-0
test/integration/roles/test_uri/files/fail1.json
+2
-0
test/integration/roles/test_uri/files/fail10.json
+2
-0
test/integration/roles/test_uri/files/fail11.json
+2
-0
test/integration/roles/test_uri/files/fail12.json
+2
-0
test/integration/roles/test_uri/files/fail13.json
+2
-0
test/integration/roles/test_uri/files/fail14.json
+2
-0
test/integration/roles/test_uri/files/fail15.json
+2
-0
test/integration/roles/test_uri/files/fail16.json
+2
-0
test/integration/roles/test_uri/files/fail17.json
+2
-0
test/integration/roles/test_uri/files/fail18.json
+2
-0
test/integration/roles/test_uri/files/fail19.json
+2
-0
test/integration/roles/test_uri/files/fail2.json
+2
-0
test/integration/roles/test_uri/files/fail20.json
+2
-0
test/integration/roles/test_uri/files/fail21.json
+2
-0
test/integration/roles/test_uri/files/fail22.json
+2
-0
test/integration/roles/test_uri/files/fail23.json
+2
-0
test/integration/roles/test_uri/files/fail24.json
+2
-0
test/integration/roles/test_uri/files/fail25.json
+2
-0
test/integration/roles/test_uri/files/fail26.json
+3
-0
test/integration/roles/test_uri/files/fail27.json
+3
-0
test/integration/roles/test_uri/files/fail28.json
+2
-0
test/integration/roles/test_uri/files/fail29.json
+2
-0
test/integration/roles/test_uri/files/fail3.json
+2
-0
test/integration/roles/test_uri/files/fail30.json
+2
-0
test/integration/roles/test_uri/files/fail4.json
+2
-0
test/integration/roles/test_uri/files/fail5.json
+2
-0
test/integration/roles/test_uri/files/fail6.json
+2
-0
test/integration/roles/test_uri/files/fail7.json
+2
-0
test/integration/roles/test_uri/files/fail8.json
+2
-0
test/integration/roles/test_uri/files/fail9.json
+2
-0
test/integration/roles/test_uri/files/pass0.json
+59
-0
test/integration/roles/test_uri/files/pass1.json
+2
-0
test/integration/roles/test_uri/files/pass2.json
+6
-0
test/integration/roles/test_uri/files/pass3.json
+2
-0
test/integration/roles/test_uri/files/pass4.json
+2
-0
test/integration/roles/test_uri/meta/main.yml
+2
-0
test/integration/roles/test_uri/tasks/main.yml
+89
-0
No files found.
test/integration/non_destructive.yml
View file @
13578738
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
-
{
role
:
test_authorized_key
,
tags
:
test_authorized_key
}
-
{
role
:
test_authorized_key
,
tags
:
test_authorized_key
}
-
{
role
:
test_get_url
,
tags
:
test_get_url
}
-
{
role
:
test_get_url
,
tags
:
test_get_url
}
-
{
role
:
test_embedded_module
,
tags
:
test_embedded_module
}
-
{
role
:
test_embedded_module
,
tags
:
test_embedded_module
}
-
{
role
:
test_uri
,
tags
:
test_uri
}
# Turn on test_binary when we start testing v2
# Turn on test_binary when we start testing v2
#- { role: test_binary, tags: test_binary }
#- { role: test_binary, tags: test_binary }
test/integration/roles/test_uri/files/README
0 → 100644
View file @
13578738
The files were taken from http://www.json.org/JSON_checker/
> If the JSON_checker is working correctly, it must accept all of the pass*.json files and reject all of the fail*.json files.
Difference with JSON_checker dataset:
- *${n}.json renamed to *${n-1}.json to be 0-based
- fail0.json renamed to pass3.json as python json module allows JSON payload to be string
- fail17.json renamed to pass4.json as python json module has no problems with deep structures
- fail32.json renamed to fail0.json to fill gap
- fail31.json renamed to fail17.json to fill gap
test/integration/roles/test_uri/files/fail0.json
0 → 100644
View file @
13578738
[
"mismatch"
}
\ No newline at end of file
test/integration/roles/test_uri/files/fail1.json
0 → 100644
View file @
13578738
[
"Unclosed array"
\ No newline at end of file
test/integration/roles/test_uri/files/fail10.json
0 → 100644
View file @
13578738
{
"Illegal expression"
:
1
+
2
}
\ No newline at end of file
test/integration/roles/test_uri/files/fail11.json
0 → 100644
View file @
13578738
{
"Illegal invocation"
:
alert()
}
\ No newline at end of file
test/integration/roles/test_uri/files/fail12.json
0 → 100644
View file @
13578738
{
"Numbers cannot have leading zeroes"
:
013
}
\ No newline at end of file
test/integration/roles/test_uri/files/fail13.json
0 → 100644
View file @
13578738
{
"Numbers cannot be hex"
:
0
x
14
}
\ No newline at end of file
test/integration/roles/test_uri/files/fail14.json
0 → 100644
View file @
13578738
[
"Illegal backslash escape:
\x
15"
]
\ No newline at end of file
test/integration/roles/test_uri/files/fail15.json
0 → 100644
View file @
13578738
[
\naked
]
\ No newline at end of file
test/integration/roles/test_uri/files/fail16.json
0 → 100644
View file @
13578738
[
"Illegal backslash escape:
\0
17"
]
\ No newline at end of file
test/integration/roles/test_uri/files/fail17.json
0 → 100644
View file @
13578738
{
"Comma instead if closing brace"
:
true
,
\ No newline at end of file
test/integration/roles/test_uri/files/fail18.json
0 → 100644
View file @
13578738
{
"Missing colon"
null
}
\ No newline at end of file
test/integration/roles/test_uri/files/fail19.json
0 → 100644
View file @
13578738
{
"Double colon"
::
null
}
\ No newline at end of file
test/integration/roles/test_uri/files/fail2.json
0 → 100644
View file @
13578738
{
unquoted_key
:
"keys must be quoted"
}
\ No newline at end of file
test/integration/roles/test_uri/files/fail20.json
0 → 100644
View file @
13578738
{
"Comma instead of colon"
,
null
}
\ No newline at end of file
test/integration/roles/test_uri/files/fail21.json
0 → 100644
View file @
13578738
[
"Colon instead of comma"
:
false
]
\ No newline at end of file
test/integration/roles/test_uri/files/fail22.json
0 → 100644
View file @
13578738
[
"Bad value"
,
truth
]
\ No newline at end of file
test/integration/roles/test_uri/files/fail23.json
0 → 100644
View file @
13578738
[
'single
quote'
]
\ No newline at end of file
test/integration/roles/test_uri/files/fail24.json
0 → 100644
View file @
13578738
[
" tab character in string "
]
\ No newline at end of file
test/integration/roles/test_uri/files/fail25.json
0 → 100644
View file @
13578738
[
"tab
\
character
\
in
\
string
\
"
]
\ No newline at end of file
test/integration/roles/test_uri/files/fail26.json
0 → 100644
View file @
13578738
[
"line
break"
]
\ No newline at end of file
test/integration/roles/test_uri/files/fail27.json
0 → 100644
View file @
13578738
[
"line
\
break"
]
\ No newline at end of file
test/integration/roles/test_uri/files/fail28.json
0 → 100644
View file @
13578738
[
0
e
]
\ No newline at end of file
test/integration/roles/test_uri/files/fail29.json
0 → 100644
View file @
13578738
[
0
e+
]
\ No newline at end of file
test/integration/roles/test_uri/files/fail3.json
0 → 100644
View file @
13578738
[
"extra comma"
,]
\ No newline at end of file
test/integration/roles/test_uri/files/fail30.json
0 → 100644
View file @
13578738
[
0
e+
-1
]
\ No newline at end of file
test/integration/roles/test_uri/files/fail4.json
0 → 100644
View file @
13578738
[
"double extra comma"
,,]
\ No newline at end of file
test/integration/roles/test_uri/files/fail5.json
0 → 100644
View file @
13578738
[
,
"<-- missing value"
]
\ No newline at end of file
test/integration/roles/test_uri/files/fail6.json
0 → 100644
View file @
13578738
[
"Comma after the close"
],
\ No newline at end of file
test/integration/roles/test_uri/files/fail7.json
0 → 100644
View file @
13578738
[
"Extra close"
]]
\ No newline at end of file
test/integration/roles/test_uri/files/fail8.json
0 → 100644
View file @
13578738
{
"Extra comma"
:
true
,}
\ No newline at end of file
test/integration/roles/test_uri/files/fail9.json
0 → 100644
View file @
13578738
{
"Extra value after close"
:
true
}
"misplaced quoted value"
\ No newline at end of file
test/integration/roles/test_uri/files/pass0.json
0 → 100644
View file @
13578738
[
"JSON Test Pattern pass1"
,
{
"object with 1 member"
:[
"array with 1 element"
]},
{},
[],
-42
,
true
,
false
,
null
,
{
"integer"
:
1234567890
,
"real"
:
-9876.543210
,
"e"
:
0.123456789e-12
,
"E"
:
1.234567890E+34
,
""
:
23456789012E66
,
"zero"
:
0
,
"one"
:
1
,
"space"
:
" "
,
"quote"
:
"
\"
"
,
"backslash"
:
"
\\
"
,
"controls"
:
"
\b\f\n\r\t
"
,
"slash"
:
"/ &
\/
"
,
"alpha"
:
"abcdefghijklmnopqrstuvwyz"
,
"ALPHA"
:
"ABCDEFGHIJKLMNOPQRSTUVWYZ"
,
"digit"
:
"0123456789"
,
"0123456789"
:
"digit"
,
"special"
:
"`1~!@#$%^&*()_+-={':[,]}|;.</>?"
,
"hex"
:
"
\u
0123
\u
4567
\u
89AB
\u
CDEF
\u
abcd
\u
ef4A"
,
"true"
:
true
,
"false"
:
false
,
"null"
:
null
,
"array"
:[
],
"object"
:{
},
"address"
:
"50 St. James Street"
,
"url"
:
"http://www.JSON.org/"
,
"comment"
:
"// /* <!-- --"
,
"# -- --> */"
:
" "
,
" s p a c e d "
:[
1
,
2
,
3
,
4
,
5
,
6
,
7
],
"compact"
:[
1
,
2
,
3
,
4
,
5
,
6
,
7
],
"jsontext"
:
"{
\"
object with 1 member
\"
:[
\"
array with 1 element
\"
]}"
,
"quotes"
:
""
\u
0022 %22 0x22 034 ""
,
"
\/\\\"\u
CAFE
\u
BABE
\u
AB98
\u
FCDE
\u
bcda
\u
ef4A
\b\f\n\r\t
`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
:
"A key can be any string"
},
0.5
,
98.6
,
99.44
,
1066
,
1e1
,
0.1e1
,
1e-1
,
1e00
,
2e+00
,
2e-00
,
"rosebud"
]
\ No newline at end of file
test/integration/roles/test_uri/files/pass1.json
0 → 100644
View file @
13578738
[[[[[[[[[[[[[[[[[[[
"Not too deep"
]]]]]]]]]]]]]]]]]]]
\ No newline at end of file
test/integration/roles/test_uri/files/pass2.json
0 → 100644
View file @
13578738
{
"JSON Test Pattern pass3"
:
{
"The outermost value"
:
"must be an object or array."
,
"In this test"
:
"It is an object."
}
}
test/integration/roles/test_uri/files/pass3.json
0 → 100644
View file @
13578738
"A JSON payload should be an object or array, not a string."
\ No newline at end of file
test/integration/roles/test_uri/files/pass4.json
0 → 100644
View file @
13578738
[[[[[[[[[[[[[[[[[[[[
"Too deep"
]]]]]]]]]]]]]]]]]]]]
\ No newline at end of file
test/integration/roles/test_uri/meta/main.yml
0 → 100644
View file @
13578738
dependencies
:
-
prepare_tests
test/integration/roles/test_uri/tasks/main.yml
0 → 100644
View file @
13578738
# test code for the uri module
# (c) 2014, Leonid Evdokimov <leon@darkk.net.ru>
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
-
name
:
set role facts
set_fact
:
http_port
:
15260
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
:
60
# this test set takes ~15 seconds to run
poll
:
0
-
wait_for
:
port={{ http_port }}
-
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
uri
:
return_content=yes url=http://localhost:{{ http_port }}/{{ item }}.json
register
:
pass
with_sequence
:
start=0 end=4 format=pass%d
-
name
:
check pass_json
assert
:
that
:
-
'
"json"
in
item.1'
-
item.0.stat.checksum == item.1.content | checksum
with_together
:
-
pass_checksum.results
-
pass.results
-
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
uri
:
return_content=yes url=http://localhost:{{ http_port }}/{{ item }}.json
register
:
fail
with_sequence
:
start=0 end=30 format=fail%d
-
name
:
check fail_json
assert
:
that
:
-
item.0.stat.checksum == item.1.content | checksum
-
'
"json"
not
in
item.1'
with_together
:
-
fail_checksum.results
-
fail.results
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment