Merge pull request #2576 from coreos-inc/full-db-tests-tox
Reenable full database testing locally and in concourse
This commit is contained in:
commit
8b148bf1d4
51 changed files with 278 additions and 318 deletions
14
initdb.py
14
initdb.py
|
@ -20,7 +20,7 @@ from data.database import (db, all_models, beta_classes, Role, TeamRole, Visibil
|
|||
ExternalNotificationEvent, ExternalNotificationMethod, NotificationKind,
|
||||
QuayRegion, QuayService, UserRegion, OAuthAuthorizationCode,
|
||||
ServiceKeyApprovalType, MediaType, LabelSourceType, UserPromptKind,
|
||||
RepositoryKind, TagKind, BlobPlacementLocation)
|
||||
RepositoryKind, TagKind, BlobPlacementLocation, User)
|
||||
from data import model
|
||||
from data.queue import WorkQueue
|
||||
from app import app, storage as store, tf
|
||||
|
@ -440,6 +440,15 @@ def wipe_database():
|
|||
def populate_database(minimal=False, with_storage=False):
|
||||
logger.debug('Populating the DB with test data.')
|
||||
|
||||
# Check if the data already exists. If so, we skip. This can happen between calls from the
|
||||
# "old style" tests and the new py.test's.
|
||||
try:
|
||||
User.get(username='devtable')
|
||||
logger.debug('DB already populated')
|
||||
return
|
||||
except User.DoesNotExist:
|
||||
pass
|
||||
|
||||
# Note: databases set up with "real" schema (via Alembic) will not have these types
|
||||
# type, so we it here it necessary.
|
||||
try:
|
||||
|
@ -663,6 +672,9 @@ def populate_database(minimal=False, with_storage=False):
|
|||
liborg = model.organization.create_organization('library', 'quay+library@devtable.com', new_user_1)
|
||||
liborg.save()
|
||||
|
||||
titiorg = model.organization.create_organization('titi', 'quay+titi@devtable.com', new_user_1)
|
||||
titiorg.save()
|
||||
|
||||
thirdorg = model.organization.create_organization('sellnsmall', 'quay+sell@devtable.com', new_user_1)
|
||||
thirdorg.save()
|
||||
|
||||
|
|
Reference in a new issue