Browse Source

see #31: simplify inventory variables

pull/42/head
Nicolas Massé 7 years ago
parent
commit
b266da7cef
  1. 12
      tests/inventory.j2
  2. 4
      tests/test-cases/01-beer-catalog-apikey.yml
  3. 4
      tests/test-cases/02-echo-api-oidc.yml
  4. 8
      tests/test-cases/03-multi-environment.yml
  5. 1
      tests/test-cases/04-one-gateway.yml
  6. 6
      tests/test-cases/05-echo-api-with-basePath.yml
  7. 6
      tests/test-cases/06-echo-api-with-cors-policy.yml
  8. 6
      tests/test-cases/07-echo-api-with-smoketest-in-extra-vars.yml
  9. 6
      tests/test-cases/08-echo-api-without-smoketest.yml
  10. 3
      tests/test-cases/common/apicast-selfmanaged-vars.yml

12
tests/inventory.j2

@ -4,12 +4,6 @@
[all:vars] [all:vars]
ansible_connection=local ansible_connection=local
{% if 'apicast_staging_domain' in test_environment.threescale %}
apicast_staging_domain={{ test_environment.threescale.apicast_staging_domain }}
{% endif %}
{% if 'apicast_production_domain' in test_environment.threescale %}
apicast_production_domain={{ test_environment.threescale.apicast_production_domain }}
{% endif %}
[threescale] [threescale]
{{ test_environment.threescale.admin_portal }} {{ test_environment.threescale.admin_portal }}
@ -20,3 +14,9 @@ threescale_cicd_sso_issuer_endpoint=https://{{ test_environment.sso.client_id }}
{% if 'wildcard_domain' in test_environment.threescale %} {% if 'wildcard_domain' in test_environment.threescale %}
threescale_cicd_wildcard_domain={{ test_environment.threescale.wildcard_domain }} threescale_cicd_wildcard_domain={{ test_environment.threescale.wildcard_domain }}
{% endif %} {% endif %}
{% if 'apicast_staging_domain' in test_environment.threescale %}
threescale_cicd_apicast_sandbox_endpoint='{% raw %}{{ threescale_cicd_default_apicast_scheme }}://{{ threescale_cicd_api_system_name|regex_replace("[^a-zA-Z0-9-]+", "-")|lower }}{{ threescale_cicd_default_staging_suffix }}{% endraw %}.{{ test_environment.threescale.apicast_staging_domain }}'
{% endif %}
{% if 'apicast_production_domain' in test_environment.threescale %}
threescale_cicd_apicast_production_endpoint='{% raw %}{{ threescale_cicd_default_apicast_scheme }}://{{ threescale_cicd_api_system_name|regex_replace("[^a-zA-Z0-9-]+", "-")|lower }}{{ threescale_cicd_default_production_suffix }}{% endraw %}.{{ test_environment.threescale.apicast_production_domain }}'
{% endif %}

4
tests/test-cases/01-beer-catalog-apikey.yml

@ -12,10 +12,6 @@
- name: Generate a random system_name for this test run - name: Generate a random system_name for this test run
import_tasks: "common/random-system-name.yml" import_tasks: "common/random-system-name.yml"
- name: Compute custom public base urls for APIcast self-managed environments
include_vars: "common/apicast-selfmanaged-vars.yml"
when: apicast_staging_domain is defined or apicast_production_domain is defined
# Test a first deployment # Test a first deployment
- import_role: - import_role:
name: 'nmasse-itix.threescale-cicd' name: 'nmasse-itix.threescale-cicd'

4
tests/test-cases/02-echo-api-oidc.yml

@ -9,10 +9,6 @@
- name: Generate a random system_name for this test run - name: Generate a random system_name for this test run
import_tasks: "common/random-system-name.yml" import_tasks: "common/random-system-name.yml"
- name: Compute custom public base urls for APIcast self-managed environments
include_vars: "common/apicast-selfmanaged-vars.yml"
when: apicast_staging_domain is defined or apicast_production_domain is defined
# Test a first deployment # Test a first deployment
- import_role: - import_role:
name: 'nmasse-itix.threescale-cicd' name: 'nmasse-itix.threescale-cicd'

8
tests/test-cases/03-multi-environment.yml

@ -11,28 +11,22 @@
tasks: tasks:
- name: Generate a random system_name for this test run - name: Generate a random system_name for this test run
import_tasks: "common/random-system-name.yml" import_tasks: "common/random-system-name.yml"
# Deploy in DEV # Deploy in DEV
- import_role: - import_role:
name: 'nmasse-itix.threescale-cicd' name: 'nmasse-itix.threescale-cicd'
vars: vars:
threescale_cicd_api_environment_name: dev threescale_cicd_api_environment_name: dev
threescale_cicd_apicast_sandbox_endpoint: '{{ threescale_cicd_default_apicast_scheme }}://{{ (threescale_cicd_api_environment_name ~ "-" ~ threescale_cicd_api_base_system_name ~ "-" ~ threescale_cicd_api_version_major)|regex_replace(''[^a-zA-Z0-9-]+'', ''-'')|lower }}{{ threescale_cicd_default_staging_suffix }}.{{ apicast_staging_domain|default(threescale_cicd_wildcard_domain) }}'
threescale_cicd_apicast_production_endpoint: '{{ threescale_cicd_default_apicast_scheme }}://{{ (threescale_cicd_api_environment_name ~ "-" ~threescale_cicd_api_base_system_name ~ "-" ~ threescale_cicd_api_version_major)|regex_replace(''[^a-zA-Z0-9-]+'', ''-'')|lower }}{{ threescale_cicd_default_production_suffix }}.{{ apicast_production_domain|default(threescale_cicd_wildcard_domain) }}'
# Deploy in TEST # Deploy in TEST
- import_role: - import_role:
name: 'nmasse-itix.threescale-cicd' name: 'nmasse-itix.threescale-cicd'
vars: vars:
threescale_cicd_api_environment_name: test threescale_cicd_api_environment_name: test
threescale_cicd_apicast_sandbox_endpoint: '{{ threescale_cicd_default_apicast_scheme }}://{{ (threescale_cicd_api_environment_name ~ "-" ~ threescale_cicd_api_base_system_name ~ "-" ~ threescale_cicd_api_version_major)|regex_replace(''[^a-zA-Z0-9-]+'', ''-'')|lower }}{{ threescale_cicd_default_staging_suffix }}.{{ apicast_staging_domain|default(threescale_cicd_wildcard_domain) }}'
threescale_cicd_apicast_production_endpoint: '{{ threescale_cicd_default_apicast_scheme }}://{{ (threescale_cicd_api_environment_name ~ "-" ~threescale_cicd_api_base_system_name ~ "-" ~ threescale_cicd_api_version_major)|regex_replace(''[^a-zA-Z0-9-]+'', ''-'')|lower }}{{ threescale_cicd_default_production_suffix }}.{{ apicast_production_domain|default(threescale_cicd_wildcard_domain) }}'
# Deploy in PROD # Deploy in PROD
- import_role: - import_role:
name: 'nmasse-itix.threescale-cicd' name: 'nmasse-itix.threescale-cicd'
vars: vars:
threescale_cicd_api_environment_name: prod threescale_cicd_api_environment_name: prod
threescale_cicd_apicast_sandbox_endpoint: '{{ threescale_cicd_default_apicast_scheme }}://{{ (threescale_cicd_api_environment_name ~ "-" ~ threescale_cicd_api_base_system_name ~ "-" ~ threescale_cicd_api_version_major)|regex_replace(''[^a-zA-Z0-9-]+'', ''-'')|lower }}{{ threescale_cicd_default_staging_suffix }}.{{ apicast_staging_domain|default(threescale_cicd_wildcard_domain) }}'
threescale_cicd_apicast_production_endpoint: '{{ threescale_cicd_default_apicast_scheme }}://{{ (threescale_cicd_api_environment_name ~ "-" ~threescale_cicd_api_base_system_name ~ "-" ~ threescale_cicd_api_version_major)|regex_replace(''[^a-zA-Z0-9-]+'', ''-'')|lower }}{{ threescale_cicd_default_production_suffix }}.{{ apicast_production_domain|default(threescale_cicd_wildcard_domain) }}'
# Cleanup the DEV # Cleanup the DEV
- import_role: - import_role:
name: 'nmasse-itix.threescale-cicd' name: 'nmasse-itix.threescale-cicd'

1
tests/test-cases/04-one-gateway.yml

@ -10,7 +10,6 @@
threescale_cicd_openapi_smoketest_operation: GET_beer threescale_cicd_openapi_smoketest_operation: GET_beer
# Both Public Base URL are the same # Both Public Base URL are the same
threescale_cicd_apicast_sandbox_endpoint: '{{ threescale_cicd_apicast_production_endpoint }}' threescale_cicd_apicast_sandbox_endpoint: '{{ threescale_cicd_apicast_production_endpoint }}'
threescale_cicd_apicast_production_endpoint: '{{ threescale_cicd_default_apicast_scheme }}://{{ (threescale_cicd_api_base_system_name ~ "-" ~ threescale_cicd_api_version_major)|regex_replace(''[^a-zA-Z0-9-]+'', ''-'')|lower }}{{ threescale_cicd_default_production_suffix }}.{{ apicast_production_domain|default(threescale_cicd_wildcard_domain) }}'
tasks: tasks:
- name: Generate a random system_name for this test run - name: Generate a random system_name for this test run
import_tasks: "common/random-system-name.yml" import_tasks: "common/random-system-name.yml"

6
tests/test-cases/05-echo-api-with-basePath.yml

@ -1,6 +1,6 @@
--- ---
- name: Deploy the Echo API to a 3scale SaaS instance, with hosted APIcasts - name: Deploy the Echo API with a basepath
hosts: threescale hosts: threescale
gather_facts: no gather_facts: no
vars: vars:
@ -9,10 +9,6 @@
- name: Generate a random system_name for this test run - name: Generate a random system_name for this test run
import_tasks: "common/random-system-name.yml" import_tasks: "common/random-system-name.yml"
- name: Compute custom public base urls for APIcast self-managed environments
include_vars: "common/apicast-selfmanaged-vars.yml"
when: apicast_staging_domain is defined or apicast_production_domain is defined
# Test a first deployment # Test a first deployment
- import_role: - import_role:
name: 'nmasse-itix.threescale-cicd' name: 'nmasse-itix.threescale-cicd'

6
tests/test-cases/06-echo-api-with-cors-policy.yml

@ -1,6 +1,6 @@
--- ---
- name: Deploy the Echo API to a 3scale SaaS instance, with hosted APIcasts and CORS - name: Deploy the Echo API with CORS
hosts: threescale hosts: threescale
gather_facts: no gather_facts: no
vars: vars:
@ -11,10 +11,6 @@
- name: Generate a random system_name for this test run - name: Generate a random system_name for this test run
import_tasks: "common/random-system-name.yml" import_tasks: "common/random-system-name.yml"
- name: Compute custom public base urls for APIcast self-managed environments
include_vars: "common/apicast-selfmanaged-vars.yml"
when: apicast_staging_domain is defined or apicast_production_domain is defined
# Deploy the service # Deploy the service
- import_role: - import_role:
name: 'nmasse-itix.threescale-cicd' name: 'nmasse-itix.threescale-cicd'

6
tests/test-cases/07-echo-api-with-smoketest-in-extra-vars.yml

@ -1,6 +1,6 @@
--- ---
- name: Deploy the Echo API to a 3scale SaaS instance, with hosted APIcasts and smoketests in extra vars - name: Deploy the Echo API with smoketests in extra vars
hosts: threescale hosts: threescale
gather_facts: no gather_facts: no
vars: vars:
@ -10,10 +10,6 @@
- name: Generate a random system_name for this test run - name: Generate a random system_name for this test run
import_tasks: "common/random-system-name.yml" import_tasks: "common/random-system-name.yml"
- name: Compute custom public base urls for APIcast self-managed environments
include_vars: "common/apicast-selfmanaged-vars.yml"
when: apicast_staging_domain is defined or apicast_production_domain is defined
# Deploy the service # Deploy the service
- import_role: - import_role:
name: 'nmasse-itix.threescale-cicd' name: 'nmasse-itix.threescale-cicd'

6
tests/test-cases/08-echo-api-without-smoketest.yml

@ -1,6 +1,6 @@
--- ---
- name: Deploy the Echo API to a 3scale SaaS instance, with hosted APIcasts and no smoketests - name: Deploy the Echo API with no smoketests
hosts: threescale hosts: threescale
gather_facts: no gather_facts: no
vars: vars:
@ -10,10 +10,6 @@
- name: Generate a random system_name for this test run - name: Generate a random system_name for this test run
import_tasks: "common/random-system-name.yml" import_tasks: "common/random-system-name.yml"
- name: Compute custom public base urls for APIcast self-managed environments
include_vars: "common/apicast-selfmanaged-vars.yml"
when: apicast_staging_domain is defined or apicast_production_domain is defined
# Deploy the service # Deploy the service
- import_role: - import_role:
name: 'nmasse-itix.threescale-cicd' name: 'nmasse-itix.threescale-cicd'

3
tests/test-cases/common/apicast-selfmanaged-vars.yml

@ -1,3 +0,0 @@
---
threescale_cicd_apicast_sandbox_endpoint: '{{ threescale_cicd_default_apicast_scheme }}://{{ (threescale_cicd_api_base_system_name ~ "-" ~ threescale_cicd_api_version_major)|regex_replace(''[^a-zA-Z0-9-]+'', ''-'')|lower }}{{ threescale_cicd_default_staging_suffix }}.{{ apicast_staging_domain }}'
threescale_cicd_apicast_production_endpoint: '{{ threescale_cicd_default_apicast_scheme }}://{{ (threescale_cicd_api_base_system_name ~ "-" ~ threescale_cicd_api_version_major)|regex_replace(''[^a-zA-Z0-9-]+'', ''-'')|lower }}{{ threescale_cicd_default_production_suffix }}.{{ apicast_production_domain }}'
Loading…
Cancel
Save