Esempio n. 1
0
def listBucket(targ):
    if (dssSanityLib.CLI_USER):
        userObj = dssSanityLib.getConnection(int(dssSanityLib.CLI_USER))
    else:
        userObj = dssSanityLib.getConnection()
    if (not targ):
        dssSanityLib.listBucketNum(userObj, "user")
        dssSanityLib.listBucket(userObj, "user")
    else:
        print "Listing bucket " + str(targ)
        b = userObj.get_bucket(targ)
        for k in b.list():
            print str(k)
    return
Esempio n. 2
0
def listBucket(targ):
    if (dssSanityLib.CLI_USER):
        userObj = dssSanityLib.getConnection(int(dssSanityLib.CLI_USER))
    else:
        userObj = dssSanityLib.getConnection()
    if (not targ):
        dssSanityLib.listBucketNum(userObj, "user")
        dssSanityLib.listBucket(userObj, "user")
    else:
        print "Listing bucket " + str(targ)
        b = userObj.get_bucket(targ)
        for k in b.list():
            print str(k)
    return
Esempio n. 3
0
def dnsNamesTest():
    userObj = dssSanityLib.getConnection()
    result = 0
    longHundredChars = 'a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789'
    longFiftyChars = 'a123456789a123456789a123456789a123456789a123456789'
    longTFTchars = longHundredChars + longHundredChars + longFiftyChars + 'qwe'
    try:
        userObj.create_bucket(longTFTchars)
        userObj.delete_bucket(longTFTchars)
        print "Able to create bucket with 253 chars in name"
    except:
        print "Failed to create or delete a valid bucket name"
        print "Unexpected error: ", sys.exc_info()
        return -1

    try:
        badName = longTFTchars + 'abc'
        userObj.create_bucket(badName)
        print "Unexpectedly created bucket with illegally long name"
        dssSanityLib.listBucketNum(userObj, "user")
        dssSanityLib.listBucket(userObj, "user")
        userObj.delete_bucket(badName)
        result = -1
    except:
        print "Expected failure in creating 256 char bucket name"
        print "Expected error: ", sys.exc_info()

    try:
        badName = 'Abc'
        userObj.create_bucket(badName)
        print "Unexpectedly created bucket with capital letter name"
        dssSanityLib.listBucketNum(userObj, "user")
        dssSanityLib.listBucket(userObj, "user")
        userObj.delete_bucket(badName)
        result = -1
    except:
        print "Expected failure in creating bucket name with CAPS"
        print "Expected error: ", sys.exc_info()

    try:
        badName = 'bc/'
        userObj.create_bucket(badName)
        print "Unexpectedly created bucket with slash in name"
        dssSanityLib.listBucketNum(userObj, "user")
        dssSanityLib.listBucket(userObj, "user")
        userObj.delete_bucket(badName)
        result = -1
    except:
        print "Expected failure in creating bucket name with slash"
        print "Expected error: ", sys.exc_info()

    return result
Esempio n. 4
0
def dnsNamesTest():
    userObj = dssSanityLib.getConnection()
    result = 0
    longHundredChars = 'a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789'
    longFiftyChars = 'a123456789a123456789a123456789a123456789a123456789'
    longTFTchars = longHundredChars + longHundredChars + longFiftyChars + 'qwe'
    try:
        userObj.create_bucket(longTFTchars)
        userObj.delete_bucket(longTFTchars)
        print "Able to create bucket with 253 chars in name"
    except:
        print "Failed to create or delete a valid bucket name"
        print "Unexpected error: ", sys.exc_info()
        return -1

    try:
        badName = longTFTchars + 'abc'
        userObj.create_bucket(badName)
        print "Unexpectedly created bucket with illegally long name"
        dssSanityLib.listBucketNum(userObj, "user")
        dssSanityLib.listBucket(userObj, "user")
        userObj.delete_bucket(badName)
        result = -1
    except:
        print "Expected failure in creating 256 char bucket name"
        print "Expected error: ", sys.exc_info()

    try:
        badName = 'Abc'
        userObj.create_bucket(badName)
        print "Unexpectedly created bucket with capital letter name"
        dssSanityLib.listBucketNum(userObj, "user")
        dssSanityLib.listBucket(userObj, "user")
        userObj.delete_bucket(badName)
        result = -1
    except:
        print "Expected failure in creating bucket name with CAPS"
        print "Expected error: ", sys.exc_info()

    try:
        badName = 'bc/'
        userObj.create_bucket(badName)
        print "Unexpectedly created bucket with slash in name"
        dssSanityLib.listBucketNum(userObj, "user")
        dssSanityLib.listBucket(userObj, "user")
        userObj.delete_bucket(badName)
        result = -1
    except:
        print "Expected failure in creating bucket name with slash"
        print "Expected error: ", sys.exc_info()

    return result