From c4573068692a72892d8cefdfd562a9d366c2c78a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Thu, 13 Sep 2018 16:43:35 +0200 Subject: [PATCH] see #29: put the cors policy higher in the stack --- tasks/api-calls/smoke_test.yml | 13 +++++++++++++ ...aas-with-hosted-apicast-with-cors-policy.yml | 17 +++++++++++++++++ vars/main.yml | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/3scale-saas-with-hosted-apicast-with-cors-policy.yml diff --git a/tasks/api-calls/smoke_test.yml b/tasks/api-calls/smoke_test.yml index c0afa49..b4c8944 100644 --- a/tasks/api-calls/smoke_test.yml +++ b/tasks/api-calls/smoke_test.yml @@ -18,3 +18,16 @@ delay: '{{ threescale_cicd_delay }}' # temporary fix for https://github.com/ansible/ansible/issues/28078 until: 'threescale_cicd_tmpresponse is success' + +- name: Running smoke tests (CORS) ! + uri: + url: '{{ threescale_cicd_smoke_test_url }}' + headers: '{{ threescale_cicd_smoke_test_headers|combine({ ''Origin'': threescale_cicd_smoke_test_url}) }}' + validate_certs: no + method: OPTIONS + register: threescale_cicd_tmpresponse + retries: '{{ threescale_cicd_retries }}' + delay: '{{ threescale_cicd_delay }}' + # temporary fix for https://github.com/ansible/ansible/issues/28078 + until: 'threescale_cicd_tmpresponse is success' + when: 'threescale_cicd_apicast_policies_cors|bool' diff --git a/tests/3scale-saas-with-hosted-apicast-with-cors-policy.yml b/tests/3scale-saas-with-hosted-apicast-with-cors-policy.yml new file mode 100644 index 0000000..6c9e5fe --- /dev/null +++ b/tests/3scale-saas-with-hosted-apicast-with-cors-policy.yml @@ -0,0 +1,17 @@ +--- + +- name: Deploy the Echo API to a 3scale SaaS instance, with hosted APIcasts and no smoketests + hosts: threescale + gather_facts: no + vars: + threescale_cicd_openapi_smoketest_operation: Echo + threescale_cicd_apicast_policies_cors: yes + threescale_cicd_openapi_file: '{{ playbook_dir }}/api/echo-api-bare.yaml' + tasks: + # Deploy the service + - import_role: + name: 'nmasse-itix.threescale-cicd' + # Delete the service + - import_role: + name: 'nmasse-itix.threescale-cicd' + tasks_from: 'cleanup' diff --git a/vars/main.yml b/vars/main.yml index e92300d..b7a5233 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -75,7 +75,7 @@ threescale_cicd_wanted_policies: '{{ lookup(''template'', ''wanted_policies.j2'' ## what we have threescale_cicd_existing_policies: '{{ lookup(''template'', ''existing_policies.j2'') }}' # update the items that we want and we have -threescale_cicd_policies_to_update: '{{ threescale_cicd_existing_policies|union(threescale_cicd_wanted_policies) }}' +threescale_cicd_policies_to_update: '{{ threescale_cicd_wanted_policies|union(threescale_cicd_existing_policies) }}' ## ## 3scale API Payload definition