Skip to content

Commit

Permalink
Merge pull request #3588 from uselagoon/testing/update-service-tests
Browse files Browse the repository at this point in the history
Use updated internal-services-test URL syntax and add persistent storage test
  • Loading branch information
tobybellwood authored Nov 7, 2023
2 parents 85e41b3 + 622f19a commit 40bb218
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 38 deletions.
29 changes: 19 additions & 10 deletions tests/files/services/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,26 @@ services:
image: uselagoon/mariadb-10.5
labels:
lagoon.type: mariadb-single
lagoon.persistent.size: 100Mi
ports:
- '3306'

mariadb-10-6:
image: uselagoon/mariadb-10.6
mariadb-10-11:
image: uselagoon/mariadb-10.11
labels:
lagoon.type: mariadb
ports:
- '3306'

mongo-4:
image: uselagoon/mongo:latest
image: uselagoon/mongo-4
labels:
lagoon.type: mongo
ports:
- '27017'

opensearch-2:
image: uselagoon/opensearch-2:latest
image: uselagoon/opensearch-2
environment:
- cluster.name=opensearch-cluster
- node.name=opensearch
Expand All @@ -39,26 +40,28 @@ services:
soft: 65536
hard: 65536
labels:
lagoon.type: none # gets set to opensearch in a second deployment
lagoon.type: opensearch
lagoon.persistent.size: 100Mi
ports:
- '9200'

postgres-13:
image: uselagoon/postgres-13
labels:
lagoon.type: postgres-single
lagoon.persistent.size: 100Mi
ports:
- '5432'

postgres-14:
image: uselagoon/postgres-14
postgres-15:
image: uselagoon/postgres-15
labels:
lagoon.type: postgres
ports:
- '5432'

redis-6:
image: uselagoon/redis-6
redis-7:
image: uselagoon/redis-7
labels:
lagoon.type: redis
ports:
Expand All @@ -68,6 +71,7 @@ services:
image: uselagoon/solr-8
labels:
lagoon.type: solr
lagoon.persistent.size: 100Mi
ports:
- "8983"
command:
Expand All @@ -77,6 +81,11 @@ services:
internal-services-test:
image: uselagoon/internal-services-test:main
labels:
lagoon.type: basic
lagoon.type: basic-persistent
lagoon.persistent: /app/files
lagoon.persistent.size: 10Mi
lagoon.persistent.class: bulk
ports:
- "3000"
environment:
- STORAGE_LOCATION=/app/files
44 changes: 16 additions & 28 deletions tests/tests/services/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@
hosts: localhost
serial: 1
vars:
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/mariadb-10.5"
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/mariadb?service=mariadb-10.5"
expected_content: "LAGOON_GIT_SAFE_BRANCH={{ branch }}"
tasks:
- ansible.builtin.include_tasks: ../../checks/check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for the hash, mariadb 10.6 service"
- name: "{{ testname }} - check if {{ project }} is deployed with searching for the hash, mariadb 10.11 service"
hosts: localhost
serial: 1
vars:
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/mariadb-10.6"
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/mariadb?service=mariadb-10.11"
expected_content: "LAGOON_GIT_SAFE_BRANCH={{ branch }}"
tasks:
- ansible.builtin.include_tasks: ../../checks/check-url-content.yaml
Expand All @@ -51,16 +51,16 @@
hosts: localhost
serial: 1
vars:
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/postgres-13"
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/postgres?service=postgres-13"
expected_content: "LAGOON_GIT_SAFE_BRANCH={{ branch }}"
tasks:
- ansible.builtin.include_tasks: ../../checks/check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for the hash, postgres-14 service"
- name: "{{ testname }} - check if {{ project }} is deployed with searching for the hash, postgres-15 service"
hosts: localhost
serial: 1
vars:
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/postgres-14"
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/postgres?service=postgres-15"
expected_content: "LAGOON_GIT_SAFE_BRANCH={{ branch }}"
tasks:
- ansible.builtin.include_tasks: ../../checks/check-url-content.yaml
Expand All @@ -69,7 +69,7 @@
hosts: localhost
serial: 1
vars:
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/mongo-4"
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/mongo?service=mongo-4"
expected_content: "LAGOON_GIT_SAFE_BRANCH={{ branch }}"
tasks:
- ansible.builtin.include_tasks: ../../checks/check-url-content.yaml
Expand All @@ -78,46 +78,34 @@
hosts: localhost
serial: 1
vars:
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/solr-8"
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/solr?service=solr-8"
expected_content: "LAGOON_GIT_SAFE_BRANCH={{ branch }}"
tasks:
- ansible.builtin.include_tasks: ../../checks/check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for the hash, redis-6 service"
- name: "{{ testname }} - check if {{ project }} is deployed with searching for the hash, redis-7 service"
hosts: localhost
serial: 1
vars:
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/redis-6"
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/redis?service=redis-7"
expected_content: "LAGOON_GIT_SAFE_BRANCH={{ branch }}"
tasks:
- ansible.builtin.include_tasks: ../../checks/check-url-content.yaml

- name: "{{ testname }} - api add envVariable on {{ project }}"
hosts: localhost
serial: 1
vars:
envName: "LAGOON_SERVICE_TYPES"
envValue: "opensearch-2:opensearch"
envScope: "BUILD"
project: "{{ project }}"
tasks:
- ansible.builtin.include_tasks: ../../tasks/api/add-project-variable.yaml

- name: "{{ testname }} - api deployEnvironmentBranch on {{ project }}, which should deploy the first commit"
- name: "{{ testname }} - check if {{ project }} is deployed with searching for the hash, opensearch-2 service"
hosts: localhost
serial: 1
vars:
branch: "{{ branch }}"
project: "{{ project }}"
namespace: "{{ project | regex_replace('_', '-') }}-{{ branch | regex_replace('/', '-') }}"
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/opensearch?service=opensearch-2"
expected_content: "LAGOON_GIT_SAFE_BRANCH={{ branch }}"
tasks:
- ansible.builtin.include_tasks: ../../tasks/api/deploy-no-sha.yaml
- ansible.builtin.include_tasks: ../../checks/check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for the hash, opensearch-2 service"
- name: "{{ testname }} - check if {{ project }} is deployed with searching for the hash, persistent storage"
hosts: localhost
serial: 1
vars:
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/opensearch-2"
url: "http://internal-services-test.{{ project | regex_replace('_', '-') }}.{{ branch | regex_replace('/', '-') }}.{{ route_suffix }}/storage?path=/app/files"
expected_content: "LAGOON_GIT_SAFE_BRANCH={{ branch }}"
tasks:
- ansible.builtin.include_tasks: ../../checks/check-url-content.yaml
Expand Down

0 comments on commit 40bb218

Please sign in to comment.