Skip to content
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

Test in parallel to speed up GH actions #749

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/run_django_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ jobs:
AWS_ACCESS_KEY_ID: sampleaccesskey
AWS_SECRET_ACCESS_KEY: samplesecretkey
AWS_REGION: us-east-1
run: coverage run src/manage.py test meshapi meshapi_hooks
run: |
coverage run -a src/manage.py test meshapi meshapi_hooks --tag skip_on_parallel &&
coverage run -a src/manage.py test meshapi meshapi_hooks --parallel 4 --exclude-tag skip_on_parallel
- name: Write coverage report to disk
run: coverage html
- name: Upload coverage reports to Codecov
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ dev = [
"beautifulsoup4==4.12.*",
"freezegun==1.5.1",
"moto[s3]==5.0.*",
"tblib==3.0.*",
]

[project.scripts]
Expand Down
3 changes: 2 additions & 1 deletion src/meshapi/tests/test_join_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import requests_mock
from django.contrib.auth.models import User
from django.db.models import Q
from django.test import Client, TestCase, TransactionTestCase
from django.test import Client, TestCase, TransactionTestCase, tag
from parameterized import parameterized

from meshapi.models import Building, Install, Member, Node
Expand Down Expand Up @@ -1127,6 +1127,7 @@ def slow_install_init(*args, **kwargs):


@patch("meshapi.views.forms.DISABLE_RECAPTCHA_VALIDATION", True)
@tag("skip_on_parallel")
class TestJoinFormRaceCondition(TransactionTestCase):
c = Client()
admin_c = Client()
Expand Down
3 changes: 2 additions & 1 deletion src/meshapi_hooks/tests/test_webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
multiprocessing.set_start_method("fork")

from celery.contrib.testing.worker import start_worker
from django.test import TransactionTestCase
from django.test import TransactionTestCase, tag

from meshapi.models import Building, Install, Member
from meshapi.tests.sample_data import sample_building, sample_install, sample_member
Expand Down Expand Up @@ -48,6 +48,7 @@ def respond_bad():
flask_app.run(host="127.0.0.1", port=8091, debug=False)


@tag("skip_on_parallel")
class TestMeshAPIWebhooks(TransactionTestCase):
@classmethod
def setUpClass(cls):
Expand Down
Loading