]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/d4n: Start redis up before rgw
authorSamarah <samarah.uriarte@ibm.com>
Fri, 1 Mar 2024 17:15:36 +0000 (17:15 +0000)
committerPritha Srivastava <prsrivas@redhat.com>
Tue, 2 Apr 2024 15:54:52 +0000 (21:24 +0530)
Signed-off-by: Samarah <samarah.uriarte@ibm.com>
qa/suites/rgw/d4n/tasks/rgw_d4ntests.yaml
qa/tasks/d4ntests.py
qa/tasks/redis.py [new file with mode: 0644]

index 893119e82d5d9d6ba6cff6d2b5f670a75a87560e..ed63bc2fc895eb973b7ed11446858bad7fec9657 100644 (file)
@@ -5,6 +5,8 @@ tasks:
       deb: ['s3cmd', 'redis']
       rpm: ['s3cmd', 'redis']
 - ceph:
+- redis:
+    client.0:
 - rgw: [client.0]
 - tox: [client.0]
 - exec:
index 9a7b6a1f6d6a18e47c5475458245895c37a8e6dd..d943bf962f104afbe755da1437c52b6a1f81e45e 100644 (file)
@@ -7,13 +7,6 @@ from teuthology.packaging import remove_package
 
 log = logging.getLogger(__name__)
 
-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)
-
 display_name='Foo'
 email='foo@foo.com'
 access_key='test3'
@@ -50,14 +43,11 @@ class D4NTests(Task):
             log.debug('D4N Tests: Host is: {host}'.format(host=host))
 
         self.create_user()
-        self.redis_startup()
 
     def end(self):
         super(D4NTests, self).end()
         log.info('D4N Tests: END')
 
-        self.redis_shutdown()
-
         for client in self.all_clients:
             self.remove_packages(client)
             self.delete_user(client)
@@ -92,41 +82,9 @@ class D4NTests(Task):
                         ],
                     )
 
-    def redis_startup(self):
-        try:
-            for client in self.all_clients:
-                self.ctx.cluster.only(client).run(
-                    args=[
-                        'sudo',
-                        'redis-server',
-                        '--daemonize',
-                        'yes'
-                        ],
-                    )
-    
-        except Exception as err:
-            log.debug('D4N Tests: Error starting up a Redis server')
-            log.debug(err)
-
-    def redis_shutdown(self):
-        try:
-            for client in self.all_clients:
-                self.ctx.cluster.only(client).run(
-                    args=[
-                        'sudo',
-                        'redis-cli',
-                        'shutdown',
-                        ],
-                    )
-    
-        except Exception as err:
-            log.debug('D4N Tests: Error shutting down a Redis server')
-            log.debug(err)
-
     def remove_packages(self, client):
         (remote,) = self.ctx.cluster.only(client).remotes.keys()
         remove_package('s3cmd', remote)
-        remove_package('redis', remote)
 
     def delete_user(self, client):
         log.info("D4N Tests: Deleting S3 user...")
diff --git a/qa/tasks/redis.py b/qa/tasks/redis.py
new file mode 100644 (file)
index 0000000..1124f60
--- /dev/null
@@ -0,0 +1,84 @@
+import logging
+
+from teuthology import misc as teuthology
+from teuthology.task import Task
+from teuthology.orchestra import run
+from teuthology.packaging import remove_package
+
+log = logging.getLogger(__name__)
+
+class Redis(Task):
+
+    def __init__(self, ctx, config):
+        super(Redis, self).__init__(ctx, config)
+        self.log = log
+        log.info('Redis Task: __INIT__ ')
+        
+        clients = ['client.{id}'.format(id=id_)
+                   for id_ in teuthology.all_roles_of_type(self.ctx.cluster, 'client')]
+        self.all_clients = []
+        for client in clients:
+            if client in self.config:
+                self.all_clients.extend([client])
+        if self.all_clients is None:
+            self.all_clients = 'client.0'
+
+    def setup(self):
+        super(Redis, self).setup()
+        log.info('Redis Task: SETUP')
+
+    def begin(self):
+        super(Redis, self).begin()
+        log.info('Redis Task: BEGIN')
+
+        for (host, roles) in self.ctx.cluster.remotes.items():
+            log.debug('Redis Task: Cluster config is: {cfg}'.format(cfg=roles))
+            log.debug('Redis Task: Host is: {host}'.format(host=host))
+
+        self.redis_startup()
+
+    def end(self):
+        super(Redis, self).end()
+        log.info('Redis Task: END')
+
+        self.redis_shutdown()
+
+        for client in self.all_clients:
+            self.remove_redis_package(client)
+
+    def redis_startup(self):
+        try:
+            for client in self.all_clients:
+                self.ctx.cluster.only(client).run(
+                    args=[
+                        'sudo',
+                        'redis-server',
+                        '--daemonize',
+                        'yes'
+                        ],
+                    )
+    
+        except Exception as err:
+            log.debug('Redis Task: Error starting up a Redis server')
+            log.debug(err)
+
+    def redis_shutdown(self):
+        try:
+            for client in self.all_clients:
+                self.ctx.cluster.only(client).run(
+                    args=[
+                        'sudo',
+                        'redis-cli',
+                        'shutdown',
+                        ],
+                    )
+    
+        except Exception as err:
+            log.debug('Redis Task: Error shutting down a Redis server')
+            log.debug(err)
+
+    def remove_redis_package(self, client):
+        (remote,) = self.ctx.cluster.only(client).remotes.keys()
+        remove_package('redis', remote)
+
+task = Redis