Fix full database test script to not fail randomly
- Switches database schema creation to alembic, which solves the MySQL issue (and makes sure we test migrations as well) - Adds a few time.sleep(1) to work around MySQL's second-precision issue when adding items to queues and then immediately retrieving them - Disables the storage proxy tests when running against non-SQLite databases, as it causes failures with the multiple process and multiple transactions - Changes initdb to support only populating the database, as well as fixing a few small items around the test data when working with non-SQLite data
This commit is contained in:
parent
244bf2a070
commit
e6ee538e15
5 changed files with 41 additions and 19 deletions
|
@ -3,6 +3,7 @@
|
|||
import unittest
|
||||
import datetime
|
||||
import logging
|
||||
import time
|
||||
import re
|
||||
import json as py_json
|
||||
|
||||
|
@ -2041,8 +2042,8 @@ class TestDeleteRepository(ApiTestCase):
|
|||
params=dict(repository=self.SIMPLE_REPO))
|
||||
|
||||
# Add a build queue item for the repo and another repo.
|
||||
dockerfile_build_queue.put([ADMIN_ACCESS_USER, 'simple'], '{}')
|
||||
dockerfile_build_queue.put([ADMIN_ACCESS_USER, 'anotherrepo'], '{}')
|
||||
dockerfile_build_queue.put([ADMIN_ACCESS_USER, 'simple'], '{}', available_after=-1)
|
||||
dockerfile_build_queue.put([ADMIN_ACCESS_USER, 'anotherrepo'], '{}', available_after=-1)
|
||||
|
||||
# Delete the repository.
|
||||
self.deleteResponse(Repository, params=dict(repository=self.SIMPLE_REPO))
|
||||
|
@ -2563,6 +2564,7 @@ class TestRepositoryNotifications(ApiTestCase):
|
|||
params=dict(repository=ADMIN_ACCESS_USER + '/simple', uuid=uuid))
|
||||
|
||||
# Ensure the item is in the queue.
|
||||
time.sleep(1) # Makes sure the queue get works on MySQL with its second-level precision.
|
||||
found = notification_queue.get()
|
||||
self.assertIsNotNone(found)
|
||||
self.assertTrue('notification_uuid' in found['body'])
|
||||
|
|
Reference in a new issue