diff --git a/tasks/read_openapi_file.yml b/tasks/read_openapi_file.yml index df716df..70c5c89 100644 --- a/tasks/read_openapi_file.yml +++ b/tasks/read_openapi_file.yml @@ -185,5 +185,5 @@ when: 'threescale_cicd_openapi_smoketest_operation is defined and threescale_cicd_openapi_smoketest_operation|length > 0' - set_fact: - threescale_cicd_openapi_smoketest_path: '{{ threescale_cicd_api_operations[threescale_cicd_openapi_smoketest_operation].path }}' + threescale_cicd_openapi_smoketest_path: '{{ threescale_cicd_api_basepath }}{{ threescale_cicd_api_operations[threescale_cicd_openapi_smoketest_operation].path }}' when: 'threescale_cicd_openapi_smoketest_operation is defined and threescale_cicd_openapi_smoketest_operation|length > 0' diff --git a/tasks/update_mapping_rules.yml b/tasks/update_mapping_rules.yml index 520fd90..00d2cc8 100644 --- a/tasks/update_mapping_rules.yml +++ b/tasks/update_mapping_rules.yml @@ -13,7 +13,7 @@ - name: Build a list of our expected/wanted mapping rules set_fact: - threescale_cicd_tmp_wanted_mapping_rules: '{{ threescale_cicd_tmp_wanted_mapping_rules|combine({ threescale_cicd_tmp_operation.key: { "http_method": threescale_cicd_tmp_operation.value.verb.upper(), "pattern": threescale_cicd_tmp_operation.value.path ~ "$", "delta": 1 } }) }}' + threescale_cicd_tmp_wanted_mapping_rules: '{{ threescale_cicd_tmp_wanted_mapping_rules|combine({ threescale_cicd_tmp_operation.key: { "http_method": threescale_cicd_tmp_operation.value.verb.upper(), "pattern": threescale_cicd_api_basepath ~ threescale_cicd_tmp_operation.value.path ~ "$", "delta": 1 } }) }}' with_dict: '{{ threescale_cicd_api_operations }}' loop_control: loop_var: threescale_cicd_tmp_operation diff --git a/tests/3scale-saas-with-hosted-apicast-with-basePath.yml b/tests/3scale-saas-with-hosted-apicast-with-basePath.yml new file mode 100644 index 0000000..90be8ec --- /dev/null +++ b/tests/3scale-saas-with-hosted-apicast-with-basePath.yml @@ -0,0 +1,14 @@ +--- + +- name: Deploy the Echo API to a 3scale SaaS instance, with hosted APIcasts + hosts: threescale + gather_facts: no + vars: + threescale_cicd_openapi_file: '{{ playbook_dir }}/api/echo-api-with-basePath.yaml' + roles: + # Test first deployment + - { role: 'nmasse-itix.threescale-cicd', vars: { 'round': 1 } } + # Verify idempotence + - { role: 'nmasse-itix.threescale-cicd', vars: { 'round': 2 } } + post_tasks: + - import_tasks: 'cleanup.yaml' diff --git a/tests/api/echo-api-with-basePath.yaml b/tests/api/echo-api-with-basePath.yaml new file mode 100644 index 0000000..fd14e3b --- /dev/null +++ b/tests/api/echo-api-with-basePath.yaml @@ -0,0 +1,36 @@ +swagger: '2.0' +info: + x-threescale-system-name: 'echo-api-with-basepath' + title: 'Echo API' + description: 'A very simple API.' + contact: + name: 'Nicolas MASSE' + url: 'http://github.com/nmasse-itix' + email: nmasse@redhat.com + license: + name: 'MIT License' + url: 'https://opensource.org/licenses/MIT' + version: '1.0' +host: 'echo-api.3scale.net' +basePath: '/test-base' +schemes: +- http +paths: + /echo: + get: + operationId: Echo + tags: + - echo + summary: 'Get an echo' + description: 'Get an echo from the server' + x-threescale-smoketests-operation: true + responses: + 200: + description: 'An Echo from the server' +security: +- apikey: [] +securityDefinitions: + apikey: + name: api-key + in: header + type: apiKey