File: list_artifacts.py

package info (click to toggle)
python-azure 20250603%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 851,724 kB
  • sloc: python: 7,362,925; ansic: 804; javascript: 287; makefile: 195; sh: 145; xml: 109
file content (30 lines) | stat: -rw-r--r-- 1,231 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from devtools_testutils.perfstress_tests import PerfStressTest
from azure.containerregistry import ContainerRegistryClient
from azure.containerregistry.aio import ContainerRegistryClient as AsyncContainerRegistryClient


class ListArtifactsTest(PerfStressTest):
    def __init__(self, arguments):
        super().__init__(arguments)

        endpoint = self.get_from_env("CONTAINERREGISTRY_ANONREGISTRY_ENDPOINT")
        audience = "https://management.azure.com"
        self.anon_client = ContainerRegistryClient(endpoint=endpoint, credential=None, audience=audience)
        self.async_anon_client = AsyncContainerRegistryClient(endpoint=endpoint, credential=None, audience=audience)
        self.repository = "node"

    async def close(self):
        await self.async_anon_client.close()
        await super().close()

    def run_sync(self):
        for _ in self.anon_client.list_manifest_properties(self.repository):
            pass

    async def run_async(self):
        async for _ in self.async_anon_client.list_manifest_properties(self.repository):
            pass