Skip to content

Fix integration tests to run with instance_principal #510

Fix integration tests to run with instance_principal

Fix integration tests to run with instance_principal #510

name: tests/unitary/default_setup/**
on:
workflow_dispatch:
pull_request:
branches:
- main
- "release/**"
- develop
paths:
- "ads/**"
- pyproject.toml
- "**requirements.txt"
- .github/workflows/run-unittests.yml
- .github/workflows/run-unittests-default_setup.yml
# Cancel in progress workflows on pull_requests.
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
# hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5
jobs:
test:
name: python ${{ matrix.python-version }}, default_setup
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
# Caching python libraries installed with pip
# https://github.com/actions/cache/blob/main/examples.md#python---pip
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/test-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: "Test config setup"
shell: bash
env:
HOME_RUNNER_DIR: /home/runner
run: |
set -x # print commands that are executed
mkdir -p "$HOME_RUNNER_DIR"/.oci
openssl genrsa -out $HOME_RUNNER_DIR/.oci/oci_ads_user.pem 2048
cat <<EOT >> "$HOME_RUNNER_DIR/.oci/config"
[DEFAULT]
user=ocid1.user.oc1..xxx
fingerprint=00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
tenancy=ocid1.tenancy.oc1..xxx
region=test_region
key_file=$HOME_RUNNER_DIR/.oci/oci_ads_user.pem
EOT
ls -lha "$HOME_RUNNER_DIR"/.oci
echo "Test config file:"
cat $HOME_RUNNER_DIR/.oci/config
- name: "Run default_setup tests folder ONLY with minimum ADS dependencies"
timeout-minutes: 15
shell: bash
env:
NoDependency: True
run: |
set -x # print commands that are executed
$CONDA/bin/conda init
source /home/runner/.bashrc
pip install -r test-requirements.txt
python -m pytest -v -p no:warnings --durations=5 tests/unitary/default_setup