feat: complete published registry contracts and gated SRO ingestion
All checks were successful
Mostovik Backend CI/CD / Tests and lint (push) Successful in 3m55s
Mostovik Backend CI/CD / Build linux/amd64 release images (push) Successful in 3m43s
Mostovik Backend CI/CD / Deploy and verify internal main (push) Has been skipped
Mostovik Backend CI/CD / Deploy customer main (push) Has been skipped
Mostovik Backend CI/CD / Deploy dev (push) Successful in 1m45s

This commit is contained in:
Aleksandr Meshchryakov
2026-09-14 17:01:02 +02:00
parent 49cbfd265c
commit 18971d33ec
76 changed files with 33156 additions and 311 deletions

View File

@@ -2,8 +2,10 @@
from importlib import import_module
from tempfile import TemporaryDirectory
from unittest.mock import patch
from apps.parsers.models import ParserLoadLog
from celery.exceptions import Retry
from django.apps import apps as django_apps
from django.conf import settings
from django.core.cache import cache
@@ -145,16 +147,21 @@ class SourceRecordExportArtifactsTaskTest(TestCase):
result = refresh_source_record_export_artifacts()
self.assertEqual(result["status"], "success")
self.assertEqual(result["artifacts_count"], 40)
self.assertEqual(result["artifacts_count"], 43)
self.assertEqual(result["export_year"], timezone.localdate().year)
self.assertIsNone(cache.get(settings.SOURCE_RECORD_EXPORT_LOCK_KEY))
def test_refresh_task_skips_when_another_generation_holds_lock(self):
def test_refresh_task_retries_when_another_generation_holds_lock(self):
cache.set(settings.SOURCE_RECORD_EXPORT_LOCK_KEY, "busy", timeout=300)
result = refresh_source_record_export_artifacts()
self.assertEqual(result, {"status": "skipped", "reason": "locked"})
with patch.object(
refresh_source_record_export_artifacts,
"retry",
side_effect=Retry("lock held"),
) as retry, self.assertRaises(Retry):
refresh_source_record_export_artifacts()
retry.assert_called_once_with(countdown=30, max_retries=12)
self.assertEqual(cache.get(settings.SOURCE_RECORD_EXPORT_LOCK_KEY), "busy")
class SourceRecordExportScheduleMigrationTest(TestCase):