Ejemplo n.º 1
0
class UploadTest(_BlobTest):
    def __init__(self, arguments):
        super().__init__(arguments)
        blob_name = "downloadtest"
        self.blob_client = self.container_client.get_blob_client(blob_name)
        self.async_blob_client = self.async_container_client.get_blob_client(
            blob_name)
        self.upload_stream = RandomStream(self.args.size)
        self.upload_stream_async = AsyncRandomStream(self.args.size)

    async def global_setup(self):
        await super().global_setup()
        data = get_random_bytes(self.args.size)
        await self.async_blob_client.upload_blob(data)

    def run_sync(self):
        self.upload_stream.reset()
        self.blob_client.upload_blob(self.upload_stream,
                                     length=self.args.size,
                                     overwrite=True,
                                     max_concurrency=self.args.max_concurrency)

    async def run_async(self):
        self.upload_stream_async.reset()
        await self.async_blob_client.upload_blob(
            self.upload_stream_async,
            length=self.args.size,
            overwrite=True,
            max_concurrency=self.args.max_concurrency)
Ejemplo n.º 2
0
 def __init__(self, arguments):
     super().__init__(arguments)
     blob_name = "downloadtest"
     self.blob_client = self.container_client.get_blob_client(blob_name)
     self.async_blob_client = self.async_container_client.get_blob_client(
         blob_name)
     self.upload_stream = RandomStream(self.args.size)
     self.upload_stream_async = AsyncRandomStream(self.args.size)
Ejemplo n.º 3
0
 def __init__(self, arguments):
     super().__init__(arguments)
     file_name = "filetest-" + str(uuid.uuid4())
     self.file_client = self.fs_client.get_file_client(file_name)
     self.async_file_client = self.async_fs_client.get_file_client(
         file_name)
     self.upload_stream = RandomStream(self.args.size)
     self.upload_stream_async = AsyncRandomStream(self.args.size)
Ejemplo n.º 4
0
class LegacyUploadTest(_LegacyContainerTest):
    def __init__(self, arguments):
        super().__init__(arguments)
        self.blob_name = "blobtest-" + str(uuid.uuid4())
        self.upload_stream = RandomStream(self.args.size)
    
    def run_sync(self):
        self.upload_stream.reset()
        self.service_client.create_blob_from_stream(
            container_name=self.container_name,
            blob_name=self.blob_name,
            stream=self.upload_stream,
            max_connections=self.args.max_concurrency)

    async def run_async(self):
        raise NotImplementedError("Async not supported for legacy T1 tests.")
Ejemplo n.º 5
0
class LegacyUploadTest(_LegacyShareTest):
    def __init__(self, arguments):
        super().__init__(arguments)
        self.file_name = "sharefiletest-" + str(uuid.uuid4())
        self.upload_stream = RandomStream(self.args.size)

    def run_sync(self):
        self.upload_stream.reset()
        self.service_client.create_file_from_stream(
            share_name=self.share_name,
            directory_name=None,
            file_name=self.file_name,
            stream=self.upload_stream,
            count=self.args.size,
            max_connections=self.args.max_concurrency)

    async def run_async(self):
        raise NotImplementedError("Async not supported for legacy T1 tests.")
Ejemplo n.º 6
0
class UploadTest(_FileTest):
    def __init__(self, arguments):
        super().__init__(arguments)
        self.upload_stream = RandomStream(self.args.size)
        self.upload_stream_async = AsyncRandomStream(self.args.size)

    def run_sync(self):
        self.upload_stream.reset()
        self.sharefile_client.upload_file(
            self.upload_stream,
            length=self.args.size,
            max_concurrency=self.args.max_concurrency)

    async def run_async(self):
        self.upload_stream_async.reset()
        await self.async_sharefile_client.upload_file(
            self.upload_stream_async,
            length=self.args.size,
            max_concurrency=self.args.max_concurrency)
Ejemplo n.º 7
0
class UploadTest(_BlobTest):
    def __init__(self, arguments):
        super().__init__(arguments)
        self.upload_stream = RandomStream(self.args.size)
        self.upload_stream_async = AsyncRandomStream(self.args.size)

    def run_sync(self):
        self.upload_stream.reset()
        self.blob_client.upload_blob(self.upload_stream,
                                     length=self.args.size,
                                     overwrite=True,
                                     max_concurrency=self.args.max_concurrency)

    async def run_async(self):
        self.upload_stream_async.reset()
        await self.async_blob_client.upload_blob(
            self.upload_stream_async,
            length=self.args.size,
            overwrite=True,
            max_concurrency=self.args.max_concurrency)
Ejemplo n.º 8
0
class AppendTest(_FileSystemTest):
    def __init__(self, arguments):
        super().__init__(arguments)
        file_name = "filetest-" + str(uuid.uuid4())
        self.file_client = self.fs_client.get_file_client(file_name)
        self.async_file_client = self.async_fs_client.get_file_client(
            file_name)
        self.upload_stream = RandomStream(self.args.size)
        self.upload_stream_async = AsyncRandomStream(self.args.size)

    async def setup(self):
        await self.async_file_client.create_file()

    def run_sync(self):
        self.upload_stream.reset()
        self.file_client.append_data(self.upload_stream,
                                     length=self.args.size,
                                     offset=0)

    async def run_async(self):
        self.upload_stream_async.reset()
        await self.async_file_client.append_data(self.upload_stream_async,
                                                 length=self.args.size,
                                                 offset=0)
Ejemplo n.º 9
0
 def __init__(self, arguments):
     super().__init__(arguments)
     self.upload_stream = RandomStream(self.args.size)
     self.upload_stream_async = AsyncRandomStream(self.args.size)
Ejemplo n.º 10
0
 def __init__(self, arguments):
     super().__init__(arguments)
     self.blob_name = "blobtest-" + str(uuid.uuid4())
     self.upload_stream = RandomStream(self.args.size)