Exemplo n.º 1
0
 def tearDown(self):
     for bucket in self.bucket_list:
         try:
             logger.debug("delete all keys in bucket: %s", bucket.name)
             utils.delete_keys(bucket, self.target)
             self.data_conn.delete_bucket(bucket.name)
         except Exception as err:
             logger.warn("Delete bucket exception: %s", str(err))
     super(TestBucketAccess, self).tearDown()
Exemplo n.º 2
0
    def tearDown(self):
        if self.__tmpdir is not None:
            logger.debug("delete tmpdir: %s", self.__tmpdir)
            shutil.rmtree(self.__tmpdir)
            self.__tmpdir = None

        if self.__bucket is not None:
            logger.debug("delete all keys in bucket: %s", self.__bucket_name)
            # Sometime the bucket just disappears
            # Since this is the tearDown() function, just ignore it
            # Case: object_post_test.py:TestObjectPost.test_post_object_with_special_valid_name
            utils.delete_keys(self.__bucket, self.target)
            if self.allow_reuse_bucket_flag is True:
                logger.debug("reuse bucket will not be deleted")
            else:
                self.data_conn.delete_bucket(self.__bucket_name)

        super(EcsDataPlaneTestBase, self).tearDown()
Exemplo n.º 3
0
    def test_object_list_from_distinct_bucket(self):
        """
        operation: list
        assertion: distinct buckets have different contents
        """
        bucket1 = self._create_bucket()
        bucket2 = self._create_bucket()

        name = keyname.get_unique_key_name()
        key = bucket1.new_key(name)
        key.set_contents_from_string(name)

        l = bucket2.list()
        l = list(l)
        eq(l, [])

        for bucket in [bucket1, bucket2]:
            logger.debug("delete all keys in bucket: %s", bucket.name)
            utils.delete_keys(bucket, self.target)
            self.data_conn.delete_bucket(bucket.name)