Browse Source

re-organize tests

pull/25/head
Nicolas Massé 8 years ago
parent
commit
43e43e650b
  1. 4
      .travis.yml
  2. 1
      tests/.meta/inventory
  3. 1
      tests/01-3scale-SaaS-Apicast-Saas/roles/threescale-cicd
  4. 9
      tests/01-3scale-SaaS-Apicast-Saas/test.yml
  5. 14
      tests/3scale-saas-with-hosted-apicast.yml
  6. 0
      tests/api/echo-api.yaml
  7. 20
      tests/cleanup.yaml
  8. 0
      tests/inventory.j2
  9. 1
      tests/roles/nmasse-itix.threescale-cicd
  10. 8
      tests/write-inventory-files.yml

4
.travis.yml

@ -5,8 +5,8 @@ install:
- pip install ansible==2.4.0
- pip install jmespath
script:
- ansible-playbook -i tests/.meta/inventory tests/.meta/main.yml
- ansible-playbook -i tests/01-*/inventory tests/01-*/test.yml
- ansible-playbook tests/write-inventory-files.yml
- ansible-playbook -i tests/inventory tests/3scale-saas-with-hosted-apicast.yml
env:
global:
secure: 0Ov2beobc70Avi7EW634Jn7Y/ILTiql/llnfTkWBlaHLQCmI//xBON95qLjaksoBqCo0AMYRUAM2Rek50qNMqOxgM+AgYCSwZeRwZnIwj+J4FHrb6kHpFGPK64iu/AQROjFKOPwI/0vl7kmUYEuQRwTbLwuS4gxxm7COpje436sJfRb6yag1dRzLOaXade2pr8ojdeByw6PyJGkJQ6To/gCyJ+UOTqhwQLTkqK+WcnrcTCRAUauVDfJr+8wXz9IZJp1hX5NIAcv8BFSs2KQWU90YKQ2B2ruZnmY4CBlvE+xh/O0ltssphDBy+b4nqwVNdb+3I1sawKGGAmawz1pBc2rqE28CmMhuUXdLkJ5oUOKsBfiygDMh7j5+fqTanyeOVMYHOZ6U5zNaQiU+aFdnqexXgnj19Yn/3cpkceQgUwyTtZj63lkUVB2mk7rPcpprVBNmCUr2SfRpHA943NtERIbB4pRRUIOoDOcR8ngj7NZaAt9crghP7pz6DKwT9PVkjzJFODqAQ4lGtOcZ8db4TUfpmVCvQIhYXxZYZX6mDNNFUTreDRJVjfXUMjvhCeub4nJ86ODcpShDFlVh+clVBcWrmlwR4EvEuy0kLaALZFS2C/Y6xTDdPI1b4He/2Ciefd1EPdwM+hmbZMk0T0+H7TfK86/nnPBNw58q00k3+dA=

1
tests/.meta/inventory

@ -1 +0,0 @@
localhost ansible_connection=local

1
tests/01-3scale-SaaS-Apicast-Saas/roles/threescale-cicd

@ -1 +0,0 @@
../../..

9
tests/01-3scale-SaaS-Apicast-Saas/test.yml

@ -1,9 +0,0 @@
---
- 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 }}/echo-api.yaml'
roles:
- threescale-cicd

14
tests/3scale-saas-with-hosted-apicast.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.yaml'
roles:
# Test first deployment
- { name: 'nmasse-itix.threescale-cicd', vars: { 'round': 1 } }
# Verify idempotence
- { name: 'nmasse-itix.threescale-cicd', vars: { 'round': 2 } }
post_tasks:
- import_tasks: 'cleanup.yaml'

0
tests/01-3scale-SaaS-Apicast-Saas/echo-api.yaml → tests/api/echo-api.yaml

20
tests/cleanup.yaml

@ -0,0 +1,20 @@
---
- name: Delete the created service and any dependent object
uri:
url: 'https://{{ inventory_hostname }}/admin/api/services/{{ threescale_cicd_api_service_id }}.json?access_token={{ threescale_cicd_access_token|urlencode }}'
validate_certs: no
method: DELETE
status_code: 200
register: threescale_cicd_tmpresponse
changed_when: 'threescale_cicd_tmpresponse.status == 200'
when: 'threescale_cicd_api_service_id is defined'
- name: Delete the created ActiveDocs
uri:
url: 'https://{{ inventory_hostname }}/admin/api/active_docs/{{ threescale_cicd_api_activedocs_id }}.json?access_token={{ threescale_cicd_access_token|urlencode }}'
validate_certs: no
method: DELETE
status_code: 200
register: threescale_cicd_tmpresponse
changed_when: 'threescale_cicd_tmpresponse.status == 200'
when: 'threescale_cicd_api_activedocs_id is defined'

0
tests/01-3scale-SaaS-Apicast-Saas/inventory.j2 → tests/inventory.j2

1
tests/roles/nmasse-itix.threescale-cicd

@ -0,0 +1 @@
../..

8
tests/.meta/main.yml → tests/write-inventory-files.yml

@ -3,6 +3,8 @@
- name: Write the inventory files for the included test cases
hosts: localhost
gather_facts: no
vars:
ansible_connection: local
tasks:
- set_fact:
threescale_inventory: '{{ lookup(''env'', ''THREESCALE_INVENTORY'')|b64decode|from_json }}'
@ -14,9 +16,9 @@
- name: Find the Jinja2 templates to process
find:
paths: '{{ playbook_dir }}/../'
patterns: 'inventory.j2'
recurse: yes
paths: '{{ playbook_dir }}'
patterns: '*.j2'
recurse: no
register: templates
- name: Process the Jinja2 templates
Loading…
Cancel
Save