Phase 1 of migrating APPR-specific tables to tables with the Appr
prefix
Fixes https://jira.coreos.com/browse/QUAY-950
This commit is contained in:
parent
6622f27c93
commit
113bb96f29
28 changed files with 699 additions and 176 deletions
|
@ -6,13 +6,13 @@ from cnr.tests.conftest import *
|
|||
from cnr.tests.test_apiserver import BaseTestServer
|
||||
from cnr.tests.test_models import CnrTestModels
|
||||
|
||||
import data.appr_model.blob as oci_blob
|
||||
import data.appr_model.blob as appr_blob
|
||||
|
||||
from data.database import User
|
||||
from data.model import organization, user
|
||||
from endpoints.appr import registry # Needed to register the endpoint
|
||||
from endpoints.appr.cnr_backend import Channel, Package, QuayDB
|
||||
from endpoints.appr.models_cnr import model as oci_app_model
|
||||
from endpoints.appr.models_cnr import model as appr_app_model
|
||||
|
||||
from test.fixtures import *
|
||||
|
||||
|
@ -28,7 +28,7 @@ class ChannelTest(Channel):
|
|||
@classmethod
|
||||
def dump_all(cls, package_class=None):
|
||||
result = []
|
||||
for repo in oci_app_model.list_applications(with_channels=True):
|
||||
for repo in appr_app_model.list_applications(with_channels=True):
|
||||
for chan in repo.channels:
|
||||
result.append({'name': chan.name, 'current': chan.current, 'package': repo.name})
|
||||
return result
|
||||
|
@ -51,17 +51,17 @@ class PackageTest(Package):
|
|||
@classmethod
|
||||
def dump_all(cls, blob_cls):
|
||||
result = []
|
||||
for repo in oci_app_model.list_applications(with_channels=True):
|
||||
for repo in appr_app_model.list_applications(with_channels=True):
|
||||
package_name = repo.name
|
||||
for release in repo.releases:
|
||||
for mtype in cls.manifests(package_name, release):
|
||||
package = oci_app_model.fetch_release(package_name, release, mtype)
|
||||
package = appr_app_model.fetch_release(package_name, release, mtype)
|
||||
blob = blob_cls.get(package_name, package.manifest.content.digest)
|
||||
app_data = cls._apptuple_to_dict(package)
|
||||
app_data.pop('digest')
|
||||
app_data['channels'] = [
|
||||
x.name
|
||||
for x in oci_app_model.list_release_channels(package_name, package.release, False)
|
||||
for x in appr_app_model.list_release_channels(package_name, package.release, False)
|
||||
]
|
||||
app_data['blob'] = blob.b64blob
|
||||
result.append(app_data)
|
||||
|
@ -141,11 +141,11 @@ class TestQuayModels(CnrTestModels):
|
|||
assert p.release == "2.0.1"
|
||||
assert p.digest == "d3b54b7912fe770a61b59ab612a442eac52a8a5d8d05dbe92bf8f212d68aaa80"
|
||||
blob = db_with_data1.Blob.get("titi/rocketchat", p.digest)
|
||||
bdb = oci_blob.get_blob(p.digest)
|
||||
bdb = appr_blob.get_blob(p.digest, appr_app_model.models_ref)
|
||||
newblob = db_with_data1.Blob("titi/app2", blob.b64blob)
|
||||
p2 = db_with_data1.Package("titi/app2", "1.0.0", "helm", newblob)
|
||||
p2.save()
|
||||
b2db = oci_blob.get_blob(p2.digest)
|
||||
b2db = appr_blob.get_blob(p2.digest, appr_app_model.models_ref)
|
||||
assert b2db.id == bdb.id
|
||||
|
||||
def test_force_push_different_blob(self, db_with_data1):
|
||||
|
|
Reference in a new issue