]> git.proxmox.com Git - ceph.git/blobdiff - ceph/qa/tasks/ragweed.py
update ceph source to reef 18.1.2
[ceph.git] / ceph / qa / tasks / ragweed.py
index eae1806c191766e9ce1fff20f3b2c8f06f362a6a..e2b33527a0b738d61f2b2056337e531e9b81e595 100644 (file)
@@ -43,6 +43,8 @@ def get_ragweed_branches(config, client_conf):
         else:
             return [branch]
 
+def get_ragweed_dir(testdir, client):
+    return '{}/ragweed.{}'.format(testdir, client)
 
 @contextlib.contextmanager
 def download(ctx, config):
@@ -57,13 +59,14 @@ def download(ctx, config):
     log.info('Downloading ragweed...')
     testdir = teuthology.get_testdir(ctx)
     for (client, cconf) in config.items():
+        ragweed_dir = get_ragweed_dir(testdir, client)
         ragweed_repo = ctx.config.get('ragweed_repo',
                                       teuth_config.ceph_git_base_url + 'ragweed.git')
         for branch in get_ragweed_branches(ctx.config, cconf):
             log.info("Using branch '%s' for ragweed", branch)
             try:
                 ctx.cluster.only(client).sh(
-                    script=f'git clone -b {branch} {ragweed_repo} {testdir}/ragweed')
+                    script=f'git clone -b {branch} {ragweed_repo} {ragweed_dir}')
                 break
             except Exception as e:
                 exc = e
@@ -74,7 +77,7 @@ def download(ctx, config):
         if sha1 is not None:
             ctx.cluster.only(client).run(
                 args=[
-                    'cd', '{tdir}/ragweed'.format(tdir=testdir),
+                    'cd', ragweed_dir,
                     run.Raw('&&'),
                     'git', 'reset', '--hard', sha1,
                     ],
@@ -83,14 +86,10 @@ def download(ctx, config):
         yield
     finally:
         log.info('Removing ragweed...')
-        testdir = teuthology.get_testdir(ctx)
         for client in config:
+            ragweed_dir = get_ragweed_dir(testdir, client)
             ctx.cluster.only(client).run(
-                args=[
-                    'rm',
-                    '-rf',
-                    '{tdir}/ragweed'.format(tdir=testdir),
-                    ],
+                args=['rm', '-rf', ragweed_dir]
                 )
 
 
@@ -176,23 +175,13 @@ def create_users(ctx, config, run_stages):
 @contextlib.contextmanager
 def configure(ctx, config, run_stages):
     """
-    Configure the ragweed.  This includes the running of the
-    bootstrap code and the updating of local conf files.
+    Configure the local config files.
     """
     assert isinstance(config, dict)
     log.info('Configuring ragweed...')
     testdir = teuthology.get_testdir(ctx)
     for client, properties in config['clients'].items():
         (remote,) = ctx.cluster.only(client).remotes.keys()
-        remote.run(
-            args=[
-                'cd',
-                '{tdir}/ragweed'.format(tdir=testdir),
-                run.Raw('&&'),
-                './bootstrap',
-                ],
-            )
-
         preparing = 'prepare' in run_stages[client]
         if not preparing:
             # should have been prepared in a previous run
@@ -228,11 +217,18 @@ def configure(ctx, config, run_stages):
             (remote,) = ctx.cluster.only(client).remotes.keys()
             remote.run(
                 args=[
-                    'rm',
+                    'rm', '-f',
                     '{tdir}/boto.cfg'.format(tdir=testdir),
                     ],
                 )
 
+def get_toxvenv_dir(ctx):
+    return ctx.tox.venv_path
+
+def toxvenv_sh(ctx, remote, args, **kwargs):
+    activate = get_toxvenv_dir(ctx) + '/bin/activate'
+    return remote.sh(['source', activate, run.Raw('&&')] + args, **kwargs)
+
 @contextlib.contextmanager
 def run_tests(ctx, config, run_stages):
     """
@@ -243,27 +239,26 @@ def run_tests(ctx, config, run_stages):
     """
     assert isinstance(config, dict)
     testdir = teuthology.get_testdir(ctx)
-    attrs = ["!fails_on_rgw"]
+    attrs = ["not fails_on_rgw"]
     for client, client_config in config.items():
+        ragweed_dir = get_ragweed_dir(testdir, client)
         stages = ','.join(run_stages[client])
         args = [
+            'cd', ragweed_dir, run.Raw('&&'),
             'RAGWEED_CONF={tdir}/archive/ragweed.{client}.conf'.format(tdir=testdir, client=client),
             'RAGWEED_STAGES={stages}'.format(stages=stages),
             'BOTO_CONFIG={tdir}/boto.cfg'.format(tdir=testdir),
-            '{tdir}/ragweed/virtualenv/bin/python'.format(tdir=testdir),
-            '-m', 'nose',
-            '-w',
-            '{tdir}/ragweed'.format(tdir=testdir),
+            'tox',
+            '--sitepackages',
+            '--',
             '-v',
-            '-a', ','.join(attrs),
+            '-m', ' and '.join(attrs),
             ]
         if client_config is not None and 'extra_args' in client_config:
             args.extend(client_config['extra_args'])
 
-        ctx.cluster.only(client).run(
-            args=args,
-            label="ragweed tests against rgw"
-            )
+        (remote,) = ctx.cluster.only(client).remotes.keys()
+        toxvenv_sh(ctx, remote, args, label="ragweed tests against rgw")
     yield
 
 @contextlib.contextmanager
@@ -308,6 +303,7 @@ def task(ctx, config):
               extra_args: ['--exclude', 'test_100_continue']
     """
     assert hasattr(ctx, 'rgw'), 'ragweed must run after the rgw task'
+    assert hasattr(ctx, 'tox'), 'ragweed must run after the tox task'
     assert config is None or isinstance(config, list) \
         or isinstance(config, dict), \
         "task ragweed only supports a list or dictionary for configuration"