Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from django.conf import settings | ||
from django.core import management | ||
from django.db import connections | ||
from django.test import TransactionTestCase | ||
|
||
from django_pgschemas.utils import get_tenant_model, get_domain_model | ||
|
||
TenantModel = get_tenant_model() | ||
DomainModel = get_domain_model() | ||
|
||
|
||
class ExecutorsTestCase(TransactionTestCase): | ||
""" | ||
Tests the executors. | ||
""" | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
for i in range(10): | ||
tenant = TenantModel(schema_name="tenant{}".format(i + 1)) | ||
tenant.save(verbosity=0) | ||
DomainModel.objects.create(tenant=tenant, domain="tenant{}.test.com".format(i + 1), is_primary=True) | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
for tenant in TenantModel.objects.all(): | ||
tenant.delete(force_drop=True) | ||
|
||
def test_all_schemas_in_sequential(self): | ||
# If there are no errors, then this test passed | ||
management.call_command("migrate", all_schemas=True, executor="sequential", verbosity=0) | ||
connections.close_all() | ||
|
||
def test_all_schemas_in_parallel(self): | ||
# If there are no errors, then this test passed | ||
management.call_command("migrate", all_schemas=True, executor="parallel", verbosity=0) | ||
connections.close_all() |
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