From b266da7cefc458494695f4d84594300285506c71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Fri, 25 Jan 2019 13:30:30 +0100 Subject: [PATCH] see #31: simplify inventory variables --- tests/inventory.j2 | 12 ++++++------ tests/test-cases/01-beer-catalog-apikey.yml | 4 ---- tests/test-cases/02-echo-api-oidc.yml | 4 ---- tests/test-cases/03-multi-environment.yml | 8 +------- tests/test-cases/04-one-gateway.yml | 1 - tests/test-cases/05-echo-api-with-basePath.yml | 6 +----- tests/test-cases/06-echo-api-with-cors-policy.yml | 6 +----- .../07-echo-api-with-smoketest-in-extra-vars.yml | 6 +----- tests/test-cases/08-echo-api-without-smoketest.yml | 6 +----- tests/test-cases/common/apicast-selfmanaged-vars.yml | 3 --- 10 files changed, 11 insertions(+), 45 deletions(-) delete mode 100644 tests/test-cases/common/apicast-selfmanaged-vars.yml diff --git a/tests/inventory.j2 b/tests/inventory.j2 index b0dee94..bc34acc 100644 --- a/tests/inventory.j2 +++ b/tests/inventory.j2 @@ -4,12 +4,6 @@ [all:vars] 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] {{ 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 %} threescale_cicd_wildcard_domain={{ test_environment.threescale.wildcard_domain }} {% 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 %} diff --git a/tests/test-cases/01-beer-catalog-apikey.yml b/tests/test-cases/01-beer-catalog-apikey.yml index 0887386..2cbcf1a 100644 --- a/tests/test-cases/01-beer-catalog-apikey.yml +++ b/tests/test-cases/01-beer-catalog-apikey.yml @@ -12,10 +12,6 @@ - name: Generate a random system_name for this test run 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 - import_role: name: 'nmasse-itix.threescale-cicd' diff --git a/tests/test-cases/02-echo-api-oidc.yml b/tests/test-cases/02-echo-api-oidc.yml index 366e472..091699d 100644 --- a/tests/test-cases/02-echo-api-oidc.yml +++ b/tests/test-cases/02-echo-api-oidc.yml @@ -9,10 +9,6 @@ - name: Generate a random system_name for this test run 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 - import_role: name: 'nmasse-itix.threescale-cicd' diff --git a/tests/test-cases/03-multi-environment.yml b/tests/test-cases/03-multi-environment.yml index 2645fce..a60c9c1 100644 --- a/tests/test-cases/03-multi-environment.yml +++ b/tests/test-cases/03-multi-environment.yml @@ -11,28 +11,22 @@ tasks: - name: Generate a random system_name for this test run import_tasks: "common/random-system-name.yml" - + # Deploy in DEV - import_role: name: 'nmasse-itix.threescale-cicd' vars: 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 - import_role: name: 'nmasse-itix.threescale-cicd' vars: 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 - import_role: name: 'nmasse-itix.threescale-cicd' vars: 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 - import_role: name: 'nmasse-itix.threescale-cicd' diff --git a/tests/test-cases/04-one-gateway.yml b/tests/test-cases/04-one-gateway.yml index 38b3c74..c89bcd2 100644 --- a/tests/test-cases/04-one-gateway.yml +++ b/tests/test-cases/04-one-gateway.yml @@ -10,7 +10,6 @@ threescale_cicd_openapi_smoketest_operation: GET_beer # Both Public Base URL are the same 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: - name: Generate a random system_name for this test run import_tasks: "common/random-system-name.yml" diff --git a/tests/test-cases/05-echo-api-with-basePath.yml b/tests/test-cases/05-echo-api-with-basePath.yml index dc68553..d9e6dd5 100644 --- a/tests/test-cases/05-echo-api-with-basePath.yml +++ b/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 gather_facts: no vars: @@ -9,10 +9,6 @@ - name: Generate a random system_name for this test run 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 - import_role: name: 'nmasse-itix.threescale-cicd' diff --git a/tests/test-cases/06-echo-api-with-cors-policy.yml b/tests/test-cases/06-echo-api-with-cors-policy.yml index 83c6cd9..09826a0 100644 --- a/tests/test-cases/06-echo-api-with-cors-policy.yml +++ b/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 gather_facts: no vars: @@ -11,10 +11,6 @@ - name: Generate a random system_name for this test run 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 - import_role: name: 'nmasse-itix.threescale-cicd' diff --git a/tests/test-cases/07-echo-api-with-smoketest-in-extra-vars.yml b/tests/test-cases/07-echo-api-with-smoketest-in-extra-vars.yml index 3cb5782..a096f14 100644 --- a/tests/test-cases/07-echo-api-with-smoketest-in-extra-vars.yml +++ b/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 gather_facts: no vars: @@ -10,10 +10,6 @@ - name: Generate a random system_name for this test run 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 - import_role: name: 'nmasse-itix.threescale-cicd' diff --git a/tests/test-cases/08-echo-api-without-smoketest.yml b/tests/test-cases/08-echo-api-without-smoketest.yml index 2f5a866..9e08b1f 100644 --- a/tests/test-cases/08-echo-api-without-smoketest.yml +++ b/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 gather_facts: no vars: @@ -10,10 +10,6 @@ - name: Generate a random system_name for this test run 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 - import_role: name: 'nmasse-itix.threescale-cicd' diff --git a/tests/test-cases/common/apicast-selfmanaged-vars.yml b/tests/test-cases/common/apicast-selfmanaged-vars.yml deleted file mode 100644 index b4f8b14..0000000 --- a/tests/test-cases/common/apicast-selfmanaged-vars.yml +++ /dev/null @@ -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 }}'