1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00
Files
quay/workers/test/test_manifestsubjectbackfillworker.py
Kenny Lee Sin Cheong 4546163e83 registry: implements the OCI 1.1 referrers API (PROJQUAY-7280) (#2597)
* registry: implements the OCI 1.1 referrers API

Migrations:
- Adds a subject column for lookup
- Adds a subject_backfilled column to track status of the backfilling
of existing manifests
- Adds a manifest_json column making use of postgres' JSONB support,
for future use.

Manifestsubjectbackfillworker: Indexes existing manifests for possible
existing subject field.

* Deprecate IGNORE_UNKNOWN_MEDIATYPES

* Cleanup
2024-06-07 13:28:13 -04:00

29 lines
964 B
Python

import pytest
from data import database, model
from test.fixtures import *
from workers.manifestsubjectbackfillworker import ManifestSubjectBackfillWorker
def test_basic(initialized_db):
worker = ManifestSubjectBackfillWorker()
# By default new manifests are already backfilled (i.e subject. if any, are parsed at creation)
assert not worker._backfill_manifest_subject()
# Set manifests to be backfilled some manifests
database.Manifest.update(subject_backfilled=False).execute()
assert worker._backfill_manifest_subject()
for manifest_row in database.Manifest.select():
assert manifest_row.subject_backfilled is True
if manifest_row.subject is not None:
database.Manifest.select().where(
database.Manifest.repository == manifest_row.repository,
database.Manifest.digest == manifest_row.subject,
).get()
assert not worker._backfill_manifest_subject()