Skip to content

Commit

Permalink
Unified integratoin tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marius-baseten committed Jul 5, 2024
1 parent 80264a5 commit e5a8c73
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 76 deletions.
41 changes: 3 additions & 38 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,41 +58,6 @@ jobs:
integration-tests:
needs: [detect-version-changed, build-and-push-truss-base-images-if-needed]
if: ${{ !failure() && !cancelled() && (needs.build-and-push-truss-base-images-if-needed.result == 'success' || needs.build-and-push-truss-base-images-if-needed.result == 'skipped') }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
split_group: [ "1", "2", "3", "4", "5" ]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-python/
- run: poetry install
- run: poetry run pytest truss/tests --durations=0 -m 'integration' --splits 5 --group ${{ matrix.split_group }} -k "not test_requirements_pydantic[1]"

# Running `test_requirements_pydantic[1]` started failing when running together with the other tests.
# We could pin down the issue to the fact that the built image had v2 installed, despite v1 in `requirements.txt`
# The test passes locally and when running in its own env, suggesting that there is a bug in docker caching / hash
# computation that makes the test falsely run with the wrong version in the image. As a stop gap solution, separating
# this particular test in its own job made it pass again.
integration-tests-pydantic-v1:
needs: [detect-version-changed, build-and-push-truss-base-images-if-needed]
if: ${{ !failure() && !cancelled() && (needs.build-and-push-truss-base-images-if-needed.result == 'success' || needs.build-and-push-truss-base-images-if-needed.result == 'skipped') }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-python/
- run: poetry install
- run: poetry run pytest truss/tests/test_model_inference.py::test_requirements_pydantic[1]

chain-integration-tests:
needs: [detect-version-changed, build-and-push-truss-base-images-if-needed]
if: ${{ !failure() && !cancelled() && (needs.build-and-push-truss-base-images-if-needed.result == 'success' || needs.build-and-push-truss-base-images-if-needed.result == 'skipped') }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-python/
- run: poetry install
- run: poetry run pytest truss-chains/tests -s --log-cli-level=INFO --durations=0 -m 'integration'
uses: ./.github/workflows/shared/integration-tests.yml
with:
build-and-push-truss-base-images-if-needed-result: needs.build-and-push-truss-base-images-if-needed.result
41 changes: 3 additions & 38 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,44 +61,9 @@ jobs:
integration-tests:
needs: [detect-version-changed, build-and-push-truss-base-images-if-needed]
if: ${{ !failure() && !cancelled() && (needs.build-and-push-truss-base-images-if-needed.result == 'success' || needs.build-and-push-truss-base-images-if-needed.result == 'skipped') }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
split_group: [ "1", "2", "3", "4", "5" ]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-python/
- run: poetry install
- run: poetry run pytest truss/tests --durations=0 -m 'integration' --splits 5 --group ${{ matrix.split_group }} -k "not test_requirements_pydantic[1]"

# Running `test_requirements_pydantic[1]` started failing when running together with the other tests.
# We could pin down the issue to the fact that the built image had v2 installed, despite v1 in `requirements.txt`
# The test passes locally and when running in its own env, suggesting that there is a bug in docker caching / hash
# computation that makes the test falsely run with the wrong version in the image. As a stop gap solution, separating
# this particular test in its own job made it pass again.
integration-tests-pydantic-v1:
needs: [detect-version-changed, build-and-push-truss-base-images-if-needed]
if: ${{ !failure() && !cancelled() && (needs.build-and-push-truss-base-images-if-needed.result == 'success' || needs.build-and-push-truss-base-images-if-needed.result == 'skipped') }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-python/
- run: poetry install
- run: poetry run pytest truss/tests/test_model_inference.py::test_requirements_pydantic[1]

chain-integration-tests:
needs: [detect-version-changed, build-and-push-truss-base-images-if-needed]
if: ${{ !failure() && !cancelled() && (needs.build-and-push-truss-base-images-if-needed.result == 'success' || needs.build-and-push-truss-base-images-if-needed.result == 'skipped') }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-python/
- run: poetry install
- run: poetry run pytest truss-chains/tests -s --log-cli-level=INFO --durations=0 -m 'integration'
uses: ./.github/workflows/shared/integration-tests.yml
with:
build-and-push-truss-base-images-if-needed-result: needs.build-and-push-truss-base-images-if-needed.result

publish-to-pypi:
needs: [detect-version-changed]
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: PR - pre-commit

on:
pull_request:
workflow_dispatch:

concurrency:
group: pr-${{ github.ref_name }}
Expand Down Expand Up @@ -78,3 +79,10 @@ jobs:
else
echo "::notice file=truss-chains/examples/::Chains examples modified and ack found int PR description."
fi
integration-tests:
if: ${{ github.event_name == 'workflow_dispatch' }}
needs: [detect-version-changed, build-and-push-truss-base-images-if-needed]
uses: ./.github/workflows/shared/integration-tests.yml
with:
build-and-push-truss-base-images-if-needed-result: "skipped"
45 changes: 45 additions & 0 deletions .github/workflows/shared/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
workflow_call:
inputs:
build-and-push-truss-base-images-if-needed-result:
required: true
type: string


integration-tests:
if: ${{ !failure() && !cancelled() && (build-and-push-truss-base-images-if-needed-result == 'success' || build-and-push-truss-base-images-if-needed-result == 'skipped') }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
split_group: [ "1", "2", "3", "4", "5" ]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-python/
- run: poetry install
- run: poetry run pytest truss/tests --durations=0 -m 'integration' --splits 5 --group ${{ matrix.split_group }} -k "not test_requirements_pydantic[1]"

# Running `test_requirements_pydantic[1]` started failing when running together with the other tests.
# We could pin down the issue to the fact that the built image had v2 installed, despite v1 in `requirements.txt`
# The test passes locally and when running in its own env, suggesting that there is a bug in docker caching / hash
# computation that makes the test falsely run with the wrong version in the image. As a stop gap solution, separating
# this particular test in its own job made it pass again.
integration-tests-pydantic-v1:
if: ${{ !failure() && !cancelled() && (build-and-push-truss-base-images-if-needed-result == 'success' || build-and-push-truss-base-images-if-needed-result == 'skipped') }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-python/
- run: poetry install
- run: poetry run pytest truss/tests/test_model_inference.py::test_requirements_pydantic[1]

chain-integration-tests:
if: ${{ !failure() && !cancelled() && (build-and-push-truss-base-images-if-needed-result == 'success' || build-and-push-truss-base-images-if-needed-result == 'skipped') }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-python/
- run: poetry install
- run: poetry run pytest truss-chains/tests -s --log-cli-level=INFO --durations=0 -m 'integration'

0 comments on commit e5a8c73

Please sign in to comment.