]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/rgw_multisite_tests.py
9 from teuthology
.exceptions
import ConfigError
10 from teuthology
.task
import Task
11 from teuthology
import misc
13 from rgw_multi
import multisite
, tests
15 log
= logging
.getLogger(__name__
)
17 class RGWMultisiteTests(Task
):
19 Runs the rgw_multi tests against a multisite configuration created by the
20 rgw-multisite task. Tests are run with nose, using any additional 'args'
21 provided. Overrides for tests.Config can be set in 'config'.
23 - rgw-multisite-tests:
25 - tasks.rgw_multi.tests:test_object_sync
30 def __init__(self
, ctx
, config
):
31 super(RGWMultisiteTests
, self
).__init
__(ctx
, config
)
34 super(RGWMultisiteTests
, self
).setup()
36 overrides
= self
.ctx
.config
.get('overrides', {})
37 misc
.deep_merge(self
.config
, overrides
.get('rgw-multisite-tests', {}))
39 if not self
.ctx
.rgw_multisite
:
40 raise ConfigError('rgw-multisite-tests must run after the rgw-multisite task')
41 realm
= self
.ctx
.rgw_multisite
.realm
42 master_zone
= realm
.meta_master_zone()
44 # create the test user
45 log
.info('creating test user..')
46 user
= multisite
.User('rgw-multisite-test-user')
47 user
.create(master_zone
, ['--display-name', 'Multisite Test User',
48 '--gen-access-key', '--gen-secret'])
50 config
= self
.config
.get('config', {})
51 tests
.init_multi(realm
, user
, tests
.Config(**config
))
52 tests
.realm_meta_checkpoint(realm
)
55 # extra arguments for nose can be passed as a string or list
56 extra_args
= self
.config
.get('args', [])
57 if not isinstance(extra_args
, list):
58 extra_args
= [extra_args
]
59 argv
= [__name__
] + extra_args
61 log
.info("running rgw multisite tests on '%s' with args=%r",
62 tests
.__name
__, extra_args
)
64 # run nose tests in the rgw_multi.tests module
65 conf
= nose
.config
.Config(stream
=get_log_stream(), verbosity
=2)
66 result
= nose
.run(defaultTest
=tests
.__name
__, argv
=argv
, config
=conf
)
68 raise RuntimeError('rgw multisite test failures')
71 """ return a log stream for nose output """
72 # XXX: this is a workaround for IOErrors when nose writes to stderr,
73 # copied from vstart_runner.py
74 class LogStream(object):
78 def write(self
, data
):
80 if "\n" in self
.buffer:
81 lines
= self
.buffer.split("\n")
82 for line
in lines
[:-1]:
84 self
.buffer = lines
[-1]
91 task
= RGWMultisiteTests