Skip to content

Commit

Permalink
SQUASH fix test_removeall and failure test
Browse files Browse the repository at this point in the history
  • Loading branch information
dzafman committed Jul 26, 2016
1 parent 6571bdd commit 50e6fc7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/test/ceph_objectstore_tool.py
Expand Up @@ -577,7 +577,7 @@ def test_get_set_inc_osdmap(CFSD_PREFIX, osd_path):
return errors


def test_removeall(CFSD_PREFIX, db, OBJREPPGS, REP_POOL, CEPH_BIN, OSDDIR):
def test_removeall(CFSD_PREFIX, db, OBJREPPGS, REP_POOL, CEPH_BIN, OSDDIR, REP_NAME, NUM_CLONED_REP_OBJECTS):
# Test removeall
TMPFILE = r"/tmp/tmp.{pid}".format(pid=os.getpid())
nullfd = open(os.devnull, "w")
Expand All @@ -595,6 +595,11 @@ def test_removeall(CFSD_PREFIX, db, OBJREPPGS, REP_POOL, CEPH_BIN, OSDDIR):
and f.split("_")[0] == basename and f.split("_")[4] == nspace]
if not fnames:
continue

if int(basename.split(REP_NAME)[1]) <= int(NUM_CLONED_REP_OBJECTS):
cmd = (CFSD_PREFIX + "'{json}' remove").format(osd=osd, json=JSON)
errors += test_failure(cmd, "Snapshots are present, use removeall to delete everything")

cmd = (CFSD_PREFIX + " --force --dry-run '{json}' remove").format(osd=osd, json=JSON)
logging.debug(cmd)
ret = call(cmd, shell=True, stdout=nullfd, stderr=nullfd)
Expand Down Expand Up @@ -1026,9 +1031,6 @@ def main(argv):
cmd = (CFSD_PREFIX + "'[\"1.3\",{{\"snapid\":\"not an int\"}}]' list-omap").format(osd=ONEOSD, pg=ONEPG)
ERRORS += test_failure(cmd, "Decode object JSON error: value type is 2 not 4")

cmd = (CFSD_PREFIX + "'[\"1.0\", {{\"hash\": 623868980, \"max\": 0, \"oid\": \"REPobject1\", \"namespace\": \"\", \"snapid\": -2, \"key\": \"\", \"pool\": 1}}]' remove").format(osd=ONEOSD)
ERRORS += test_failure(cmd, "Snapshots are present, use removeall to delete everything")

TMPFILE = r"/tmp/tmp.{pid}".format(pid=pid)
ALLPGS = OBJREPPGS + OBJECPGS
OSDS = get_osds(ALLPGS[0], OSDDIR)
Expand Down Expand Up @@ -1935,7 +1937,7 @@ def main(argv):
call("/bin/rm -rf {dir}".format(dir=TESTDIR), shell=True)
call("/bin/rm -rf {dir}".format(dir=DATADIR), shell=True)

ERRORS += test_removeall(CFSD_PREFIX, db, OBJREPPGS, REP_POOL, CEPH_BIN, OSDDIR)
ERRORS += test_removeall(CFSD_PREFIX, db, OBJREPPGS, REP_POOL, CEPH_BIN, OSDDIR, REP_NAME, NUM_CLONED_REP_OBJECTS)

# vstart() starts 4 OSDs
ERRORS += test_get_set_osdmap(CFSD_PREFIX, range(4), ALLOSDS)
Expand Down

0 comments on commit 50e6fc7

Please sign in to comment.