37
37
import subprocess
38
38
import sys
39
39
import time
40
+ import uuid
40
41
import xml .etree .ElementTree as ET
41
42
import yaml
42
43
@@ -316,8 +317,6 @@ def pattern(self):
316
317
return "*_test.cql"
317
318
318
319
319
-
320
-
321
320
class PythonTestSuite (TestSuite ):
322
321
"""A collection of Python pytests against a single Scylla instance"""
323
322
@@ -332,15 +331,17 @@ def __init__(self, path, cfg, options, mode):
332
331
333
332
topology = self .cfg .get ("topology" , { "class" : "simple" , "replication_factor" : 1 })
334
333
335
- self .start_server = self .topology_for_class (topology ["class" ], topology )
334
+ self .create_cluster = self .topology_for_class (topology ["class" ], topology )
336
335
337
- self .servers = Pool (cfg .get ("pool_size" , 2 ), self .start_server )
336
+ self .clusters = Pool (cfg .get ("pool_size" , 2 ), self .create_cluster )
338
337
339
- def create_server (self ):
338
+ def create_server (self , cluster_name , seed ):
340
339
server = ScyllaServer (
341
340
exe = self .scylla_exe ,
342
341
vardir = self .options .tmpdir ,
343
- hosts = self .hosts ,
342
+ host_registry = self .hosts ,
343
+ cluster_name = cluster_name ,
344
+ seed = seed ,
344
345
cmdline_options = self .cfg .get ("extra_scylla_cmdline_options" , []))
345
346
346
347
# Suite artefacts are removed when
@@ -353,16 +354,18 @@ def create_server(self):
353
354
return server
354
355
355
356
def topology_for_class (self , class_name , cfg ):
357
+
356
358
if class_name .lower () == "simple" :
357
359
replicas = int (cfg ["replication_factor" ])
358
- cluster = []
359
-
360
360
async def start_simple ():
361
+ cluster = []
362
+ cluster_name = str (uuid .uuid1 ())
361
363
for i in range (replicas ):
362
- server = self .create_server ()
364
+ seed = cluster [0 ].host if cluster else None
365
+ server = self .create_server (cluster_name , seed )
363
366
cluster .append (server )
364
367
await server .start ()
365
- return cluster [ 0 ]
368
+ return cluster
366
369
367
370
return start_simple
368
371
else :
@@ -610,8 +613,8 @@ def print_summary(self):
610
613
611
614
async def run (self , options ):
612
615
# This test can and should be killed gently, with SIGTERM, not with SIGKILL
613
- async with self .suite .servers .instance () as server :
614
- self .args .insert (0 , "--host={}" .format (server .host ))
616
+ async with self .suite .clusters .instance () as cluster :
617
+ self .args .insert (0 , "--host={}" .format (cluster [ 0 ] .host ))
615
618
self .success = await run_test (self , options )
616
619
logging .info ("Test #%d %s" , self .id , "succeeded" if self .success else "failed " )
617
620
return self
0 commit comments