Trivial: don't create unused temporary directory
Functional tests create unused temp directory, drop it. Change-Id: I97cfe5def1229491bbb09ca14db29c0574bb1c15
This commit is contained in:
parent
bea75077d2
commit
aa2bd671d4
@ -19,7 +19,6 @@ import copy
|
|||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
@ -789,35 +788,31 @@ class Test(Base):
|
|||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def mocked_server():
|
def mocked_server():
|
||||||
d = tempfile.mkdtemp()
|
conf_file = get_test_conf_file()
|
||||||
try:
|
with mock.patch.object(ir_utils, 'get_client'):
|
||||||
conf_file = get_test_conf_file()
|
dbsync.main(args=['--config-file', conf_file, 'upgrade'])
|
||||||
with mock.patch.object(ir_utils, 'get_client'):
|
|
||||||
dbsync.main(args=['--config-file', conf_file, 'upgrade'])
|
|
||||||
|
|
||||||
cfg.CONF.reset()
|
cfg.CONF.reset()
|
||||||
cfg.CONF.unregister_opt(dbsync.command_opt)
|
cfg.CONF.unregister_opt(dbsync.command_opt)
|
||||||
|
|
||||||
eventlet.greenthread.spawn_n(main.main,
|
eventlet.greenthread.spawn_n(main.main,
|
||||||
args=['--config-file', conf_file])
|
args=['--config-file', conf_file])
|
||||||
eventlet.greenthread.sleep(1)
|
eventlet.greenthread.sleep(1)
|
||||||
# Wait for service to start up to 30 seconds
|
# Wait for service to start up to 30 seconds
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
try:
|
try:
|
||||||
requests.get('http://127.0.0.1:5050/v1')
|
requests.get('http://127.0.0.1:5050/v1')
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
if i == 9:
|
if i == 9:
|
||||||
raise
|
raise
|
||||||
print('Service did not start yet')
|
print('Service did not start yet')
|
||||||
eventlet.greenthread.sleep(3)
|
eventlet.greenthread.sleep(3)
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
# start testing
|
# start testing
|
||||||
yield
|
yield
|
||||||
# Make sure all processes finished executing
|
# Make sure all processes finished executing
|
||||||
eventlet.greenthread.sleep(1)
|
eventlet.greenthread.sleep(1)
|
||||||
finally:
|
|
||||||
shutil.rmtree(d)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user