-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat/tests] Added Unit & Integration Tests #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ca8a961
[Ruff & Comments] Added comments in English, changed typing style, ad…
RedExtreme12 453b691
[Command Styles] Added mega-RDD formatting for commands
RedExtreme12 ee7b051
Merge branch 'main' into feat/tests
RedExtreme12 b03cfcd
[Unit-Tests] Added unit tests
RedExtreme12 2a266b8
[Unit-Tests] Added unit tests
RedExtreme12 cdd9009
[Integration-Tests] Added integrations tests
RedExtreme12 b05ace0
Merge branch 'main' into feat/tests
RedExtreme12 e3fb3c6
[Tests] Fixed according to review
RedExtreme12 ceb3cd1
[Tests] Fixed according to review
RedExtreme12 aee5f4b
[Tests] Fixed tests importing
RedExtreme12 88ad5f8
[Tests] Added cleaning docker images in runner
RedExtreme12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| services: | ||
| rabbitmq: | ||
| image: rabbitmq:4.3.1-management-alpine | ||
| container_name: django-rmq-test | ||
| ports: | ||
| - "5672:5672" # AMQP — RMQ_PORT | ||
| - "15672:15672" # Management HTTP API — RMQ_MGMT_PORT (used by the suite) | ||
| healthcheck: | ||
| test: [ "CMD", "rabbitmq-diagnostics", "-q", "ping" ] | ||
| interval: 10s | ||
| timeout: 5s | ||
| retries: 10 | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
| workflow_dispatch: | ||
| workflow_call: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
|
|
||
| # Unit tests across the supported Python versions | ||
| unit-test: | ||
| runs-on: self-hosted | ||
|
|
||
| strategy: | ||
| matrix: | ||
| python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ] | ||
| fail-fast: true | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4.2.2 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v6 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| run: uv python install ${{ matrix.python-version }} | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync --group dev --python ${{ matrix.python-version }} | ||
|
|
||
| - name: Run tests | ||
| run: uv run --python ${{ matrix.python-version }} pytest | ||
|
|
||
| - name: Clean up runner artifacts | ||
| if: always() | ||
| run: | | ||
| rm -rf .venv .pytest_cache .ruff_cache .coverage htmlcov | ||
| find . -type d -name "__pycache__" -prune -exec rm -rf {} + | ||
|
|
||
| # Integration tests against a real RabbitMQ broker (deselected in the unit job) | ||
| integration-test: | ||
| runs-on: self-hosted | ||
|
|
||
| strategy: | ||
| matrix: | ||
| python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ] | ||
| rabbitmq-version: [ "3.13", "4.0", "4.1", "4.2", "4.3" ] | ||
| fail-fast: true | ||
|
|
||
| services: | ||
| rabbitmq: | ||
| image: rabbitmq:${{ matrix.rabbitmq-version }}-management-alpine | ||
| ports: | ||
| - 5672:5672 | ||
| - 15672:15672 | ||
| options: >- | ||
| --health-cmd "rabbitmq-diagnostics -q ping" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 10 | ||
|
|
||
| env: | ||
| RMQ_HOST: localhost | ||
| RMQ_PORT: 5672 | ||
| RMQ_MGMT_PORT: 15672 | ||
| RMQ_USER: guest | ||
| RMQ_PASSWORD: guest | ||
| RMQ_VHOST: / | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4.2.2 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v6 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| run: uv python install ${{ matrix.python-version }} | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync --group dev --python ${{ matrix.python-version }} | ||
|
|
||
| - name: Run integration tests | ||
| run: uv run --python ${{ matrix.python-version }} pytest -m integration | ||
|
|
||
| - name: Tear down RabbitMQ and clean up runner artifacts | ||
| if: always() | ||
| run: | | ||
| # Force-remove any RabbitMQ containers left on the runner | ||
| docker ps -aq --filter "ancestor=rabbitmq:${{ matrix.rabbitmq-version }}-management-alpine" \ | ||
| | xargs -r docker rm -fv | ||
| docker image rm -f "rabbitmq:${{ matrix.rabbitmq-version }}-management-alpine" || true | ||
| # Wipe per-run Python/pytest build artifacts from the persistent workspace. | ||
| rm -rf .venv .pytest_cache .ruff_cache .coverage htmlcov | ||
| find . -type d -name "__pycache__" -prune -exec rm -rf {} + |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
File renamed without changes.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.