Switch test_lookups to badssl/local testing. (#16466) (#18144)

* Switch test_lookups to badssl/local testing.
* Use var for checking badssl host content.

(cherry picked from commit 394430a61e)
This commit is contained in:
Matt Clay 2016-10-21 21:40:25 -07:00 committed by GitHub
parent 60a2da09de
commit aadf342b46
4 changed files with 6 additions and 3 deletions

View file

@ -1,3 +1,4 @@
badssl_host: wrong.host.badssl.com badssl_host: wrong.host.badssl.com
httpbin_host: httpbin.org httpbin_host: httpbin.org
sni_host: sni.velox.ch sni_host: sni.velox.ch
badssl_host_substring: wrong.host.badssl.com

View file

@ -2,3 +2,4 @@
badssl_host: fail.ansible.http.tests badssl_host: fail.ansible.http.tests
httpbin_host: ansible.http.tests httpbin_host: ansible.http.tests
sni_host: sni1.ansible.http.tests sni_host: sni1.ansible.http.tests
badssl_host_substring: HTTP Client Testing Service

View file

@ -1,3 +1,4 @@
dependencies: dependencies:
- prepare_tests - prepare_tests
- prepare_http_tests

View file

@ -231,7 +231,7 @@
- name: Test that retrieving a url with invalid cert fails - name: Test that retrieving a url with invalid cert fails
set_fact: set_fact:
web_data: "{{ lookup('url', 'https://www.kennethreitz.org/') }}" web_data: "{{ lookup('url', 'https://{{ badssl_host }}/') }}"
ignore_errors: True ignore_errors: True
register: url_invalid_cert register: url_invalid_cert
@ -242,12 +242,12 @@
- name: Test that retrieving a url with invalid cert with validate_certs=False works - name: Test that retrieving a url with invalid cert with validate_certs=False works
set_fact: set_fact:
web_data: "{{ lookup('url', 'https://www.kennethreitz.org/', validate_certs=False) }}" web_data: "{{ lookup('url', 'https://{{ badssl_host }}/', validate_certs=False) }}"
register: url_no_validate_cert register: url_no_validate_cert
- assert: - assert:
that: that:
- "'www.kennethreitz.org' in web_data" - "'{{ badssl_host_substring }}' in web_data"
- name: Test cartesian lookup - name: Test cartesian lookup
debug: var={{item}} debug: var={{item}}