Add a worker for backfilling labels on manifests that have already been backfilled

This commit is contained in:
Joseph Schorr 2018-08-13 16:18:49 -04:00
parent 01ee1e693c
commit aeceea0f97
5 changed files with 148 additions and 2 deletions

View file

@ -5,6 +5,7 @@ from data.database import (TagManifestLabelMap, TagManifestToManifest, Manifest,
TagManifestLabel)
from image.docker.schema1 import DockerSchema1ManifestBuilder
from workers.manifestbackfillworker import backfill_manifest
from workers.labelbackfillworker import backfill_label
from test.fixtures import *
@ -47,6 +48,16 @@ def test_manifestbackfillworker(clear_rows, initialized_db):
in ManifestBlob.select().where(ManifestBlob.manifest == manifest_row)}
assert expected_storages == found_storages
# Ensure that backfilling labels now works.
for tml in TagManifestLabel.select().where(TagManifestLabel.annotated == tag_manifest):
assert backfill_label(tml)
label_map = TagManifestLabelMap.get(tag_manifest_label=tml)
assert label_map.tag_manifest == tag_manifest
assert label_map.manifest == manifest_row
assert label_map.manifest_label.label == label_map.tag_manifest_label.label
assert label_map.label == tml.label
def test_manifestbackfillworker_broken_manifest(clear_rows, initialized_db):
# Delete existing tag manifest so we can reuse the tag.