Skip to content

Commit f2a8454

Browse files
samarahupritha-srivastava
authored andcommitted
qa/d4n: Start redis up before rgw
Signed-off-by: Samarah <[email protected]>
1 parent 1e0e713 commit f2a8454

File tree

3 files changed

+86
-42
lines changed

3 files changed

+86
-42
lines changed

qa/suites/rgw/d4n/tasks/rgw_d4ntests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ tasks:
55
deb: ['s3cmd', 'redis']
66
rpm: ['s3cmd', 'redis']
77
- ceph:
8+
- redis:
9+
client.0:
810
- rgw: [client.0]
911
- tox: [client.0]
1012
- exec:

qa/tasks/d4ntests.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@
77

88
log = logging.getLogger(__name__)
99

10-
def get_toxvenv_dir(ctx):
11-
return ctx.tox.venv_path
12-
13-
def toxvenv_sh(ctx, remote, args, **kwargs):
14-
activate = get_toxvenv_dir(ctx) + '/bin/activate'
15-
return remote.sh(['source', activate, run.Raw('&&')] + args, **kwargs)
16-
1710
display_name='Foo'
1811
1912
access_key='test3'
@@ -50,14 +43,11 @@ def begin(self):
5043
log.debug('D4N Tests: Host is: {host}'.format(host=host))
5144

5245
self.create_user()
53-
self.redis_startup()
5446

5547
def end(self):
5648
super(D4NTests, self).end()
5749
log.info('D4N Tests: END')
5850

59-
self.redis_shutdown()
60-
6151
for client in self.all_clients:
6252
self.remove_packages(client)
6353
self.delete_user(client)
@@ -92,41 +82,9 @@ def create_user(self):
9282
],
9383
)
9484

95-
def redis_startup(self):
96-
try:
97-
for client in self.all_clients:
98-
self.ctx.cluster.only(client).run(
99-
args=[
100-
'sudo',
101-
'redis-server',
102-
'--daemonize',
103-
'yes'
104-
],
105-
)
106-
107-
except Exception as err:
108-
log.debug('D4N Tests: Error starting up a Redis server')
109-
log.debug(err)
110-
111-
def redis_shutdown(self):
112-
try:
113-
for client in self.all_clients:
114-
self.ctx.cluster.only(client).run(
115-
args=[
116-
'sudo',
117-
'redis-cli',
118-
'shutdown',
119-
],
120-
)
121-
122-
except Exception as err:
123-
log.debug('D4N Tests: Error shutting down a Redis server')
124-
log.debug(err)
125-
12685
def remove_packages(self, client):
12786
(remote,) = self.ctx.cluster.only(client).remotes.keys()
12887
remove_package('s3cmd', remote)
129-
remove_package('redis', remote)
13088

13189
def delete_user(self, client):
13290
log.info("D4N Tests: Deleting S3 user...")

qa/tasks/redis.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import logging
2+
3+
from teuthology import misc as teuthology
4+
from teuthology.task import Task
5+
from teuthology.orchestra import run
6+
from teuthology.packaging import remove_package
7+
8+
log = logging.getLogger(__name__)
9+
10+
class Redis(Task):
11+
12+
def __init__(self, ctx, config):
13+
super(Redis, self).__init__(ctx, config)
14+
self.log = log
15+
log.info('Redis Task: __INIT__ ')
16+
17+
clients = ['client.{id}'.format(id=id_)
18+
for id_ in teuthology.all_roles_of_type(self.ctx.cluster, 'client')]
19+
self.all_clients = []
20+
for client in clients:
21+
if client in self.config:
22+
self.all_clients.extend([client])
23+
if self.all_clients is None:
24+
self.all_clients = 'client.0'
25+
26+
def setup(self):
27+
super(Redis, self).setup()
28+
log.info('Redis Task: SETUP')
29+
30+
def begin(self):
31+
super(Redis, self).begin()
32+
log.info('Redis Task: BEGIN')
33+
34+
for (host, roles) in self.ctx.cluster.remotes.items():
35+
log.debug('Redis Task: Cluster config is: {cfg}'.format(cfg=roles))
36+
log.debug('Redis Task: Host is: {host}'.format(host=host))
37+
38+
self.redis_startup()
39+
40+
def end(self):
41+
super(Redis, self).end()
42+
log.info('Redis Task: END')
43+
44+
self.redis_shutdown()
45+
46+
for client in self.all_clients:
47+
self.remove_redis_package(client)
48+
49+
def redis_startup(self):
50+
try:
51+
for client in self.all_clients:
52+
self.ctx.cluster.only(client).run(
53+
args=[
54+
'sudo',
55+
'redis-server',
56+
'--daemonize',
57+
'yes'
58+
],
59+
)
60+
61+
except Exception as err:
62+
log.debug('Redis Task: Error starting up a Redis server')
63+
log.debug(err)
64+
65+
def redis_shutdown(self):
66+
try:
67+
for client in self.all_clients:
68+
self.ctx.cluster.only(client).run(
69+
args=[
70+
'sudo',
71+
'redis-cli',
72+
'shutdown',
73+
],
74+
)
75+
76+
except Exception as err:
77+
log.debug('Redis Task: Error shutting down a Redis server')
78+
log.debug(err)
79+
80+
def remove_redis_package(self, client):
81+
(remote,) = self.ctx.cluster.only(client).remotes.keys()
82+
remove_package('redis', remote)
83+
84+
task = Redis

0 commit comments

Comments
 (0)