fix: [AAP-38148] import utils module properly to solve AttributeError in get_default_organization #2332
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: e2e tests on demand | |
on: | |
workflow_dispatch: | |
inputs: | |
edaqa_ref: | |
description: 'ref of the eda-qa repository, default is main' | |
required: false | |
default: 'main' | |
pytest_filter: | |
description: 'filter for pytest to be used after "-k" flag, default is empty' | |
required: false | |
default: '' | |
pull_request_target: | |
types: | |
- labeled | |
- synchronize | |
env: | |
EDA_QA_PATH: "./eda-qa" | |
REGISTRY: quay.io | |
QUAY_USER: ansible+eda_gha | |
PYTEST_RETRIES: 2 | |
jobs: | |
api-e2e-tests: | |
if: > | |
(github.repository == 'ansible/eda-server' && github.event_name == 'workflow_dispatch') || | |
(github.repository == 'ansible/eda-server' && github.event_name == 'pull_request_target' && | |
contains(github.event.pull_request.labels.*.name, 'run-e2e')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }} | |
ref: >- | |
${{ | |
github.event_name == 'pull_request_target' && github.event.pull_request.head.ref | |
|| github.sha | |
}} | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ env.QUAY_USER }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Run api in background | |
working-directory: . | |
env: | |
DJANGO_SETTINGS_MODULE: aap_eda.settings.default | |
EDA_DEBUG: "false" | |
run: | | |
docker compose -p eda -f tools/docker/docker-compose-dev.yaml build | |
docker compose -p eda -f tools/docker/docker-compose-dev.yaml up -d | |
while ! curl -s http://localhost:8000/_healthz | grep -q "OK"; do | |
echo "Waiting for API to be ready..." | |
sleep 1 | |
done | |
- name: Fetch test suite | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
repository: ansible/eda-qa | |
ref: ${{ github.event.inputs.edaqa_ref }} | |
path: ${{ env.EDA_QA_PATH }} | |
token: ${{ secrets.EDA_QA_GITHUB_TOKEN }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
working-directory: ${{ env.EDA_QA_PATH }} | |
run: | | |
pip install . | |
pip install pytest-rerunfailures | |
- name: Run tests | |
working-directory: ${{ env.EDA_QA_PATH }} | |
env: | |
EDAQA_FERNET_PASSWORD: ${{ secrets.EDAQA_FERNET_PASSWORD }} | |
EDAQA_ENV: authenticated | |
EDAQA_MAX_CONCURRENT_ACTIVATIONS: 10 | |
EDAQA_UPSTREAM_ENABLED: true | |
run: | | |
if [ -n "${{ github.event.inputs.pytest_filter }}" ]; then | |
pytest -vv -k "${{ github.event.inputs.pytest_filter }}" --junit-xml=eda-qa-e2e-test-results.xml --reruns ${{ env.PYTEST_RETRIES }} | |
else | |
pytest -vv --junit-xml=eda-qa-e2e-test-results.xml --reruns ${{ env.PYTEST_RETRIES }} | |
fi | |
- name: Setup jUnit reporter | |
run: | | |
pip install httpie | |
echo "GIT_SHA=$(git rev-parse "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
- name: Upload jUnit test results (APDE CI) | |
working-directory: ${{ env.EDA_QA_PATH }} | |
if: github.ref == 'refs/heads/main' | |
run: >- | |
http --check-status --ignore-stdin | |
--auth "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_USER }}:${{ secrets.PDE_ORG_RESULTS_UPLOAD_PASSWORD }}" | |
-f POST "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_URL }}/api/results/upload/" | |
xunit_xml@eda-qa-e2e-test-results.xml | |
component_name=eda | |
git_commit_sha=${{ env.GIT_SHA }} | |
git_repository_url="https://github.com/${{ github.repository }}" | |
- name: Print EDA logs | |
if: always() | |
working-directory: tools/docker | |
run: | | |
docker compose -p eda -f docker-compose-dev.yaml logs | |
api-e2e-multinode-tests: | |
if: > | |
(github.repository == 'ansible/eda-server' && github.event_name == 'workflow_dispatch') || | |
(github.repository == 'ansible/eda-server' && github.event_name == 'pull_request_target' && | |
contains(github.event.pull_request.labels.*.name, 'run-e2e')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }} | |
ref: >- | |
${{ | |
github.event_name == 'pull_request_target' && github.event.pull_request.head.ref | |
|| github.sha | |
}} | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ env.QUAY_USER }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Fetch test suite | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
repository: ansible/eda-qa | |
ref: ${{ github.event.inputs.edaqa_ref }} | |
path: ${{ env.EDA_QA_PATH }} | |
token: ${{ secrets.EDA_QA_GITHUB_TOKEN }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
working-directory: ${{ env.EDA_QA_PATH }} | |
run: | | |
pip install . | |
pip install pytest-rerunfailures | |
- name: Build eda-server images | |
working-directory: . | |
run: | | |
docker compose -p eda-multinode -f tools/docker/docker-compose-dev.yaml build | |
- name: Run multinode tests | |
working-directory: ${{ env.EDA_QA_PATH }} | |
env: | |
EDAQA_FERNET_PASSWORD: ${{ secrets.EDAQA_FERNET_PASSWORD }} | |
EDAQA_ENV: default | |
EDAQA_MULTINODE_EDA_SERVER_PATH: "../" | |
# multinode-upstream tests require a longer timeout | |
# to allow for the time it takes to start the workers inside the tests | |
EDAQA_DEFAULT_TIMEOUT: 120 | |
run: | | |
pytest -vv -s eda_qa/tests/whitebox/upstream --junit-xml=eda-qa-e2e-multinode-test-results.xml --reruns ${{ env.PYTEST_RETRIES }} | |
- name: Setup jUnit reporter | |
run: | | |
pip install httpie | |
echo "GIT_SHA=$(git rev-parse "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
- name: Upload jUnit test results (APDE CI) | |
working-directory: ${{ env.EDA_QA_PATH }} | |
if: github.ref == 'refs/heads/main' | |
run: >- | |
http --check-status --ignore-stdin | |
--auth "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_USER }}:${{ secrets.PDE_ORG_RESULTS_UPLOAD_PASSWORD }}" | |
-f POST "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_URL }}/api/results/upload/" | |
xunit_xml@eda-qa-e2e-multinode-test-results.xml | |
component_name=eda | |
git_commit_sha=${{ env.GIT_SHA }} | |
git_repository_url="https://github.com/${{ github.repository }}" |