MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / test_generate_partial_access_hosts

Function test_generate_partial_access_hosts

tests/test_server.py:231–271  ·  view source on GitHub ↗
(hq_env: HqEnv)

Source from the content-addressed store, hash-verified

229
230
231def test_generate_partial_access_hosts(hq_env: HqEnv):
232 client_port = 18000 + random.randint(0, 1000)
233 worker_port = 14000 + random.randint(0, 1000)
234 hq_env.command(
235 [
236 "server",
237 "generate-access",
238 "myaccess.json",
239 f"--worker-port={worker_port}",
240 f"--client-port={client_port}",
241 "--client-file=client.json",
242 "--worker-file=worker.json",
243 "--worker-host=192.168.1.1",
244 "--client-host=baf.bar.cz",
245 ],
246 use_server_dir=False,
247 )
248
249 with open("client.json", "r") as f:
250 access = json.load(f)
251
252 schema = Schema(
253 {
254 "version": str,
255 "client": {"host": "baf.bar.cz", "port": client_port, "secret_key": str},
256 },
257 )
258 schema.validate(access)
259
260 with open("worker.json", "r") as f:
261 access = json.load(f)
262
263 schema = Schema(
264 {
265 "version": str,
266 "worker": {"host": "192.168.1.1", "port": worker_port, "secret_key": str},
267 },
268 )
269 schema.validate(access)
270
271 hq_env.start_server(args=["--access-file=myaccess.json"])
272
273
274def test_server_debug_dump(hq_env: HqEnv):

Callers

nothing calls this directly

Calls 4

commandMethod · 0.80
loadMethod · 0.80
validateMethod · 0.45
start_serverMethod · 0.45

Tested by

no test coverage detected