Adapt load-test to new zk structure

The zk handling and structure was reworked some time ago to match that
of Zuul

Change-Id: Ie967ce08f2467b1993291d48f3cc80e410e8fda7
This commit is contained in:
Benjamin Schanzel 2022-12-19 15:22:25 +01:00 committed by Clark Boylan
parent be3edd3e17
commit 94719265d8

View File

@ -2,8 +2,10 @@
import logging
import time
from nodepool import launcher, zk
from nodepool import launcher
from nodepool.cmd import NodepoolApp
from nodepool.zk import ZooKeeperClient
import nodepool.zk.zookeeper as zk
class LoadTest(NodepoolApp):
@ -47,12 +49,14 @@ class LoadTest(NodepoolApp):
self.pool = launcher.NodePool(self.args.secure, self.args.config)
config = self.pool.loadConfig()
self.zk = zk.ZooKeeper(enable_cache=False)
self.zk.connect(
list(config.zookeeper_servers.values()),
self.zk_client = ZooKeeperClient(
config.zookeeper_servers,
tls_cert=config.zookeeper_tls_cert,
tls_key=config.zookeeper_tls_key,
tls_ca=config.zookeeper_tls_ca)
tls_ca=config.zookeeper_tls_ca
)
self.zk_client.connect()
self.zk = zk.ZooKeeper(self.zk_client, enable_cache=False)
label = self.args.label
max_queue = int(self.args.max_queue)
@ -100,13 +104,12 @@ class LoadTest(NodepoolApp):
for request in failed_requests:
self.zk.deleteNodeRequest(request)
self.log.info('Handling %s fulfilled requests', len(fulfilled_requests))
self.log.info(
'Handling %s fulfilled requests', len(fulfilled_requests))
for request in fulfilled_requests:
# TODO: handle nodes
self.zk.deleteNodeRequest(request)
if __name__ == "__main__":
LoadTest.main()