Skip to content

Cloud Integration Tests #360

Cloud Integration Tests

Cloud Integration Tests #360

# 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'
# allows other workflows to reuse these unit tests:
workflow_call:
concurrency:
group: cloud-integration-tests
cancel-in-progress: false
permissions:
contents: read
jobs:
integration_tests:
name: Cloud Integration Tests
timeout-minutes: 80 # Hard cap of 1 hour 20 mins for workflow
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@v3
with:
ref: ${{ github.head_ref || github.ref }} # Checkout the current branch or PR head
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_GITHUB_RUN_ID: ${{ github.run_id }}
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
needs: integration_tests
if: always() # Run this job regardless of success or failure of the integration_tests job
continue-on-error: true # Do not fail the workflow if this job fails
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 py-marqo locally
run: pip install -e . # Install the local py-marqo repo as an editable package
- 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 }}
MARQO_GITHUB_RUN_ID: ${{ github.run_id }}
run: python tests/cloud_test_logic/delete_all_cloud_test_indexes.py