Use /taskflow/flush-test in the flush function
Instead of using /tmp use a taskflow specific directory for the flush testing utility function to make it possible to cleanup any leftover taskflow test directories if/when a test crashes or fails without cleaning itself up. Change-Id: I4d06adf9b9fbf9ec70b511e763edb52a41293e39
This commit is contained in:
committed by
Joshua Harlow
parent
19ab3392cb
commit
e565212ed5
@@ -28,6 +28,8 @@ from taskflow import states
|
||||
from taskflow.utils import misc
|
||||
from taskflow.utils import persistence_utils as p_utils
|
||||
|
||||
FLUSH_PATH_TPL = '/taskflow/flush-test/%s'
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def connect_close(*args):
|
||||
@@ -49,7 +51,7 @@ def flush(client, path=None):
|
||||
# of this context manager will be applied and all watchers will have fired
|
||||
# before this context manager exits.
|
||||
if not path:
|
||||
path = "/tmp-%s" % uuidutils.generate_uuid()
|
||||
path = FLUSH_PATH_TPL % uuidutils.generate_uuid()
|
||||
created = threading.Event()
|
||||
deleted = threading.Event()
|
||||
|
||||
@@ -64,7 +66,7 @@ def flush(client, path=None):
|
||||
return False # cause this watcher to cease to exist
|
||||
|
||||
watchers.DataWatch(client, path, func=on_created)
|
||||
client.create(path)
|
||||
client.create(path, makepath=True)
|
||||
created.wait()
|
||||
try:
|
||||
yield
|
||||
|
||||
Reference in New Issue
Block a user