Skip to content

Commit

Permalink
quota: fixing registry total worker failing to start (PROJQUAY-6010) (q…
Browse files Browse the repository at this point in the history
…uay#2217)

Fixes import in the registry total worker.
  • Loading branch information
bcaton85 committed Sep 8, 2023
1 parent d894940 commit d453882
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 3 additions & 2 deletions workers/quotaregistrysizeworker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import time

import features
from app import app, registry_model
from app import app
from data.model.quota import calculate_registry_size
from util.locking import GlobalLock
from util.log import logfile_path
from workers.gunicorn_worker import GunicornWorker
Expand All @@ -18,7 +19,7 @@ def __init__(self):
self.add_operation(self._calculate_registry_size, POLL_PERIOD)

def _calculate_registry_size(self):
registry_model.quota.calculate_registry_size()
calculate_registry_size()


def create_gunicorn_worker():
Expand Down
13 changes: 13 additions & 0 deletions workers/test/test_quotaregistrysizeworker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from test.fixtures import *
from unittest.mock import MagicMock, patch

from workers.quotaregistrysizeworker import QuotaRegistrySizeWorker


def test_registrysizeworker(initialized_db):
with patch(
"workers.quotaregistrysizeworker.calculate_registry_size", MagicMock()
) as mock_calculate_registry_size:
worker = QuotaRegistrySizeWorker()
worker._calculate_registry_size()
assert mock_calculate_registry_size.called

0 comments on commit d453882

Please sign in to comment.