Example #1
0
    def _cycle(self, rawx_host):
        length = 1024

        chunk_data = random_buffer(string.printable, length)
        metachunk_size = 9 * length
        metachunk_hash = md5().hexdigest()

        trailers = {
            CHUNK_HEADERS['metachunk_size']: metachunk_size,
            CHUNK_HEADERS['metachunk_hash']: metachunk_hash
        }

        chunk_id = self._chunk_id()
        chunk_headers = self._chunk_headers(chunk_id, chunk_data)
        chunk_url = self._chunk_url("http://" + rawx_host, chunk_id)
        global_success = True

        resp, _, success = self._direct_request('GET',
                                                chunk_url,
                                                None,
                                                None,
                                                expected_status=404)
        global_success &= success
        _, _, success = self._direct_request('DELETE',
                                             chunk_url,
                                             None,
                                             None,
                                             expected_status=404)
        global_success &= success
        _, _, success = self._direct_request('PUT',
                                             chunk_url,
                                             chunk_data,
                                             chunk_headers,
                                             expected_status=201,
                                             trailers=trailers)
        global_success &= success
        _, body, success = self._direct_request('GET',
                                                chunk_url,
                                                None,
                                                None,
                                                expected_status=200)
        global_success &= success
        success = self._compare_data(body, chunk_data)
        global_success &= success
        _, _, success = self._direct_request('DELETE',
                                             chunk_url,
                                             None,
                                             None,
                                             expected_status=204)
        global_success &= success
        _, _, success = self._direct_request('GET',
                                             chunk_url,
                                             None,
                                             None,
                                             expected_status=404)
        global_success &= success

        return global_success
Example #2
0
    def __init__(self, namespace, **kwargs):
        ep_parts = ["http:/",
                    load_namespace_conf(namespace).get('proxy'),
                    "v3.0",
                    namespace,
                    "content"]

        super(CheckMeta2, self).__init__(namespace, "meta2",
                                         endpoint="/".join(ep_parts), **kwargs)

        self.account = AccountClient({"namespace": self.ns})
        self.container = ContainerClient({"namespace": self.ns})
        self.directory = DirectoryClient({"namespace": self.ns})
        self.reference = random_buffer('0123456789ABCDEF', 64)
Example #3
0
 def _chunk_id(self):
     return '0'*16 + random_buffer('0123456789ABCDEF', 48)
Example #4
0
 def _get_params(self):
     path = random_buffer('0123456789ABCDEF', 64)
     return {'acct': self.account_name, 'ref': self.reference, 'path': path}