mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
feat(operations): worker concurrency and job retention settings
This commit is contained in:
parent
18146c30a1
commit
34582d23f3
6 changed files with 94 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
|||
from django.contrib.messages import get_messages
|
||||
from django.test import RequestFactory, TestCase
|
||||
from django.urls import reverse
|
||||
|
||||
|
|
@ -48,3 +49,8 @@ class AppSettingsTestCase(TestCase):
|
|||
# a clone stays on the host of the VM it was made from; the setting
|
||||
# that sent it to a random host is removed by migration 0015
|
||||
self.assertFalse(AppSettings.objects.filter(key="CLONE_INSTANCE_AUTO_MIGRATE").exists())
|
||||
|
||||
def test_worker_settings_refuse_values_out_of_bounds(self):
|
||||
response = self.client.post(reverse("appsettings"), {"WORKER_CONCURRENCY": "0"})
|
||||
self.assertEqual(AppSettings.objects.get(key="WORKER_CONCURRENCY").value, "4")
|
||||
self.assertTrue(any("between 1 and 16" in str(m) for m in get_messages(response.wsgi_request)))
|
||||
|
|
|
|||
|
|
@ -51,3 +51,13 @@ class SnapshotFreeSpaceSettingsTestCase(TestCase):
|
|||
limit = AppSettings._meta.get_field(field).max_length
|
||||
if limit:
|
||||
self.assertLessEqual(len(getattr(setting, field)), limit, f"{key} {field}")
|
||||
|
||||
|
||||
class WorkerSettingsTestCase(TestCase):
|
||||
def test_the_rows_fit_their_columns(self):
|
||||
for key in ("WORKER_CONCURRENCY", "JOB_RETENTION_DAYS"):
|
||||
setting = AppSettings.objects.get(key=key)
|
||||
for field in ("name", "key", "value", "description"):
|
||||
limit = AppSettings._meta.get_field(field).max_length
|
||||
if limit:
|
||||
self.assertLessEqual(len(getattr(setting, field)), limit, f"{key} {field}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue