New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test/rgw: refactor test_multi.py for use in qa suite #14433
Conversation
requesting feedback on the organization of |
src/test/rgw/rgw_multi.py
Outdated
self.connection = connection | ||
|
||
def start(self, args = None): | ||
""" start the gateway """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could enforce this via the abc
module, and the @abstractmethod
decorator, but this is also fine https://docs.python.org/2/library/abc.html#abc.abstractmethod
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neat, i didn't know about abc. are there concrete advantages to using it in this case? it's hard for me to tell based on the docs (and lack of python background)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well the difference is that this would be caught at runtime when calling the method and the abstract method would raise a TypeError
when trying to instantiate an object itself if the derived class didn't implement the method. Since this is a test suite it wouldn't probably matter that much I guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotcha. i'm really bad at python, so this is exactly the kind of feedback i need!
src/test/rgw/rgw_multi_tests.py
Outdated
|
||
def meta_master_log_status(master_zone): | ||
cmd = 'mdlog status' + master_zone.zone_args() | ||
(mdlog_status_json, retcode) = master_zone.cluster.admin_ro(cmd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tuple is not needed as such, but mostly a nit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to clarify, you're saying i should drop the ()
s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
src/test/rgw/rgw_multi_tests.py
Outdated
|
||
markers={} | ||
i = 0 | ||
for s in mdlog_status: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for i, s in enumerate(mdlog_status)
src/test/rgw/rgw_multi_tests.py
Outdated
log.info('starting meta checkpoint for zone=%s', zone.name) | ||
|
||
while True: | ||
(num_shards, sync_status) = meta_sync_status(zone) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as earlier comment wrt to function unpacking
src/test/rgw/test_multi.py
Outdated
|
||
def gen_access_key(): | ||
return ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(16)) | ||
return ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(16)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
random.choice(...)
would be fine I guess
f625cc7
to
840f10a
Compare
pushed an update with a few changes:
|
840f10a
to
5a31966
Compare
pushed an update that uses the i've made enough progress on the |
this makes the underlying scripts more flexible, because they don't depend on having a cluster name in the zgX-cY format Signed-off-by: Casey Bodley <cbodley@redhat.com>
the script was incomplete and unused, but it seems useful in itself to bring up a simple multisite cluster without having to go through test_multi.py. it's also a good test for functions in the other test-rgw-*.sh scripts Signed-off-by: Casey Bodley <cbodley@redhat.com>
Signed-off-by: Casey Bodley <cbodley@redhat.com>
Signed-off-by: Casey Bodley <cbodley@redhat.com>
Signed-off-by: Casey Bodley <cbodley@redhat.com>
logging changes inspired by Abhishek Lekshmanan <abhishek@suse.com> Signed-off-by: Casey Bodley <cbodley@redhat.com>
5a31966
to
55f276b
Compare
@cbodley the abc change doesn't work in python2, see yehudasa@fccddad for a fix |
thanks @yehudasa, i had just pushed a fix for that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
at a high level, this patch set:
rgw_multi
module undersrc/test/rgw/
test_multi.py
intorgw_multi/tests.py
,rgw_multi/multisite.py
that provides interfaces forrgw_multi/tests.py
, andtest_multi.py
to implement those interfaces inrgw_multi/multisite.py
in terms ofmstart.sh
and related shell scripts. the usage oftest_multi.py
remains unchangedthe main goal is to factor out the parts that depend on shell scripts like
mstart.sh
, so that we can run these test cases inside of the rgw qa suite against clusters set up in teuthologyrgw_multi/multisite.py
contains aSystemObject
base class and derived classes forZone
,ZoneGroup
,Period
,Realm
, andUser
. these classes provide wrappers for theradosgw-admin
commands that manipulate them, along with the ability to parse the resulting json.rgw_multi/multisite.py
also includes some interfaces forCluster
andGateway
that abstract away those details of the test environmentthe first commit reverts some changes to underlying shell scripts that forced cluster names to use a
zgX-cY
format (from zonegroup support in #14216). the second commit goes on to update and complete the unusedtest-rgw-multisite.sh
scriptuse of the
logging
module was inspired by @theanalyst's work in #10609