From aadf342b46c38748700156b281bb189f87058887 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Fri, 21 Oct 2016 21:40:25 -0700 Subject: [PATCH] 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 394430a61e6caa8462805c2b6fa58a8abb06832e) --- test/integration/roles/prepare_http_tests/defaults/main.yml | 1 + .../roles/prepare_http_tests/vars/httptester.yml | 1 + test/integration/roles/test_lookups/meta/main.yml | 1 + test/integration/roles/test_lookups/tasks/main.yml | 6 +++--- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/integration/roles/prepare_http_tests/defaults/main.yml b/test/integration/roles/prepare_http_tests/defaults/main.yml index c41faa2bd39..1114729623b 100644 --- a/test/integration/roles/prepare_http_tests/defaults/main.yml +++ b/test/integration/roles/prepare_http_tests/defaults/main.yml @@ -1,3 +1,4 @@ badssl_host: wrong.host.badssl.com httpbin_host: httpbin.org sni_host: sni.velox.ch +badssl_host_substring: wrong.host.badssl.com diff --git a/test/integration/roles/prepare_http_tests/vars/httptester.yml b/test/integration/roles/prepare_http_tests/vars/httptester.yml index e5f46db6304..0e23ae936aa 100644 --- a/test/integration/roles/prepare_http_tests/vars/httptester.yml +++ b/test/integration/roles/prepare_http_tests/vars/httptester.yml @@ -2,3 +2,4 @@ badssl_host: fail.ansible.http.tests httpbin_host: ansible.http.tests sni_host: sni1.ansible.http.tests +badssl_host_substring: HTTP Client Testing Service diff --git a/test/integration/roles/test_lookups/meta/main.yml b/test/integration/roles/test_lookups/meta/main.yml index 1050c23ce30..ee75ae6e657 100644 --- a/test/integration/roles/test_lookups/meta/main.yml +++ b/test/integration/roles/test_lookups/meta/main.yml @@ -1,3 +1,4 @@ dependencies: - prepare_tests + - prepare_http_tests diff --git a/test/integration/roles/test_lookups/tasks/main.yml b/test/integration/roles/test_lookups/tasks/main.yml index 556f23e0441..9539c45feb9 100644 --- a/test/integration/roles/test_lookups/tasks/main.yml +++ b/test/integration/roles/test_lookups/tasks/main.yml @@ -231,7 +231,7 @@ - name: Test that retrieving a url with invalid cert fails set_fact: - web_data: "{{ lookup('url', 'https://www.kennethreitz.org/') }}" + web_data: "{{ lookup('url', 'https://{{ badssl_host }}/') }}" ignore_errors: True register: url_invalid_cert @@ -242,12 +242,12 @@ - name: Test that retrieving a url with invalid cert with validate_certs=False works 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 - assert: that: - - "'www.kennethreitz.org' in web_data" + - "'{{ badssl_host_substring }}' in web_data" - name: Test cartesian lookup debug: var={{item}}