def t15(factory):
pretty = '%s t15' % __file__
print(pretty)
ws_config = {
'root' : factory.HOME.path,
'env' : [],
'tools' : {},
'flocker': {
"ftp": {
"password": "ftpuser",
"store": "/srv/www/flocker",
"port": 21,
"timeout": 30,
"user": "ftpuser"
},
"host": "cnbjlx20050",
"enable" : True,
"http": {
"doc-root": "/srv/www",
"port": 80
}
}
}
factory.write_config('workspace.json', json.dumps(ws_config))
sock, port = find_free_port()
# set remote explicitly to avoid reading config from disk
broker = Broker(
('',port), sock, remote={}, authkeys={'admin':None}, hsl_paths=[],
home=factory.HOME.path
)
broker.start()
proc = psutil.Process(broker.pid)
remote = RemoteBroker(address=('',port), home=factory.HOME.path)
l = remote.list_available() # just to make sure the connection is up
del remote # client disconnects itself
# check the CPU utilization of the broker through it's PID
result = True
for i in range(10):
if 'get_cpu_percent' in dir(proc):
load = proc.get_cpu_percent() * psutil.NUM_CPUS
else:
load = proc.cpu_percent() * psutil.cpu_count()
if load > 90.0:
print('FAIL %s: runaway CPU load: %f' % (pretty, load))
result = False
break
time.sleep(0.3)
broker.terminate()
broker.join()
return result
# check that keeping the broker busy doesn't cause dropped connections. this is
# a regression test against a bug that involved the POLLNVAL error condition on
# polling objects.
评论列表
文章目录