Skip to content

Cloud Integration Tests #301

Cloud Integration Tests

Cloud Integration Tests #301

# This workflow kickoffs cloud integration tests on pull request review
# from a person that has write access to the repo.
# It will then spin up indexes, run tox tests, and delete the indexes.
# There is also manual trigger to the workflow in which user can specify
# which job to run. Either delete_all_indexes or run_integration_tests.
# Keep in mind that delete_all_indexes will delete ALL indexes in the
# integration tests account that starts with the prefix "test_index".
name: Cloud Integration Tests
on:
workflow_dispatch:
inputs:
job_to_run:
description: 'Job to run (Options: delete_all_indexes, run_integration_tests). Keep in mind
that delete_all_indexes will delete ALL indexes in the integration tests account that starts
with the prefix "test_index". Even those that were not created by this workflow.'
required: true
default: 'run_integration_tests'
number_of_shards:
description: 'Number of shards to use for the cloud tests. Default is 1.'
required: false
default: 1
number_of_replicas:
description: 'Number of replicas to use for the cloud tests. Default is 0.'
required: false
default: 0
pull_request:
branches:
- mainline
- 'releases/*'
# allows other workflows to reuse these unit tests:
workflow_call:
permissions:
contents: read
jobs:
integration_tests:
name: Cloud Integration Tests
runs-on: ubuntu-latest
if: ${{ github.event.inputs.job_to_run == 'run_integration_tests' || github.event_name != 'workflow_dispatch' }}
environment: cloud-tests
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.8"
cache: "pip"
- name: Install tox
run: pip install tox
- name: Run tox
env:
# TODO change back to PROD once marqo v2 is in prod
MARQO_URL: ${{ secrets.STAGING_CLOUD_MARQO_URL }}
MARQO_CLOUD_URL: ${{ secrets.STAGING_CLOUD_MARQO_URL }}
MARQO_API_KEY: ${{ secrets.STAGING_CLOUD_MARQO_API_KEY }}
MARQO_NUMBER_OF_SHARDS: ${{ github.event.inputs.number_of_shards }}
MARQO_NUMBER_OF_REPLICAS: ${{ github.event.inputs.number_of_replicas }}
run: tox -e cloud_tests -- create-indexes=True use-unique-identifier=True delete-indexes=True
cleanup_indexes:
name: Cleanup cloud indexes
runs-on : ubuntu-latest
if: ${{ github.event.inputs.job_to_run == 'delete_all_indexes' }}
environment: cloud-tests
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.8"
cache: "pip"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run cleanup_indexes.py
env:
# TODO change back to PROD once marqo v2 is in prod
MARQO_URL: ${{ secrets.STAGING_CLOUD_MARQO_URL }}
MARQO_CLOUD_URL: ${{ secrets.STAGING_CLOUD_MARQO_URL }}
MARQO_API_KEY: ${{ secrets.STAGING_CLOUD_MARQO_API_KEY }}
run: python tests/cloud_test_logic/delete_all_cloud_test_indexes.py