make the tests work with new trunk
This commit is contained in:
parent
6ac1d5a332
commit
0c0aa5b6c6
@ -203,16 +203,13 @@ class ScrubberDaemon(Server):
|
||||
Server object that starts/stops/manages the Scrubber server
|
||||
"""
|
||||
|
||||
def __init__(self, test_dir, daemon=False):
|
||||
def __init__(self, test_dir, sql_connection, daemon=False):
|
||||
# NOTE(jkoelker): Set the port to 0 since we actually don't listen
|
||||
super(ScrubberDaemon, self).__init__(test_dir, 0)
|
||||
self.server_name = 'scrubber'
|
||||
self.daemon = daemon
|
||||
|
||||
self.db_file = os.path.join(self.test_dir, 'test_glance_api.sqlite')
|
||||
default_sql_connection = 'sqlite:///%s' % self.db_file
|
||||
self.sql_connection = os.environ.get('GLANCE_TEST_SQL_CONNECTION',
|
||||
default_sql_connection)
|
||||
self.sql_connection = sql_connection
|
||||
|
||||
self.pid_file = os.path.join(self.test_dir, "scrubber.pid")
|
||||
self.log_file = os.path.join(self.test_dir, "scrubber.log")
|
||||
@ -238,10 +235,14 @@ class FunctionalTest(unittest.TestCase):
|
||||
servers and clients and not just the stubbed out interfaces
|
||||
"""
|
||||
|
||||
def _set_environment(self):
|
||||
pass
|
||||
|
||||
def setUp(self):
|
||||
|
||||
self.test_id = random.randint(0, 100000)
|
||||
self.test_dir = os.path.join("/", "tmp", "test.%d" % self.test_id)
|
||||
self._set_environment()
|
||||
|
||||
self.api_port = get_unused_port()
|
||||
self.registry_port = get_unused_port()
|
||||
@ -251,7 +252,10 @@ class FunctionalTest(unittest.TestCase):
|
||||
self.registry_port)
|
||||
self.registry_server = RegistryServer(self.test_dir,
|
||||
self.registry_port)
|
||||
self.scrubber_daemon = ScrubberDaemon(self.test_dir)
|
||||
|
||||
registry_db = self.registry_server.sql_connection
|
||||
self.scrubber_daemon = ScrubberDaemon(self.test_dir,
|
||||
sql_connection=registry_db)
|
||||
|
||||
self.pid_files = [self.api_server.pid_file,
|
||||
self.registry_server.pid_file,
|
||||
|
@ -15,6 +15,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
import time
|
||||
import unittest
|
||||
|
||||
@ -41,6 +42,10 @@ class TestScrubber(functional.FunctionalTest):
|
||||
def _get_client(self):
|
||||
return client.Client("localhost", self.api_port)
|
||||
|
||||
def _set_environment(self):
|
||||
db_connection = "sqlite:///" + self.test_dir + "/glance.db"
|
||||
os.environ['GLANCE_TEST_SQL_CONNECTION'] = db_connection
|
||||
|
||||
def setUp(self):
|
||||
super(TestScrubber, self).setUp()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user