-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pk5/fix integration tests for release #195
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
from azext_aosm.common.registry import ContainerRegistry, AzureContainerRegistry | ||
from azext_aosm.vendored_sdks.models import ArtifactType | ||
from azext_aosm.vendored_sdks import HybridNetworkManagementClient | ||
from azure.core.exceptions import ServiceResponseError | ||
from knack.log import get_logger | ||
from oras.client import OrasClient | ||
|
||
|
@@ -82,12 +83,26 @@ def _manifest_credentials( | |
aosm_client: HybridNetworkManagementClient, | ||
) -> MutableMapping[str, Any]: | ||
"""Gets the details for uploading the artifacts in the manifest.""" | ||
return aosm_client.artifact_manifests.list_credential( | ||
resource_group_name=config.publisherResourceGroupName, | ||
publisher_name=config.publisherName, | ||
artifact_store_name=config.acrArtifactStoreName, | ||
artifact_manifest_name=config.acrManifestName, | ||
).as_dict() | ||
retries = 0 | ||
# This retry logic is to handle the ServiceResponseError that is hit in the integration tests. | ||
# This error is not hit when running the cli normally because the CLI framework automatically retries, | ||
# the testing framework does not support automatic retries. | ||
while retries < 2: | ||
try: | ||
credential_dict = aosm_client.artifact_manifests.list_credential( | ||
resource_group_name=config.publisherResourceGroupName, | ||
publisher_name=config.publisherName, | ||
artifact_store_name=config.acrArtifactStoreName, | ||
artifact_manifest_name=config.acrManifestName, | ||
).as_dict() | ||
break | ||
except ServiceResponseError as error: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I think if you hit an exception that isn't a ServiceResponseError the code will just exit. Is that right? If not, there's an infinite loop. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is just going to fail with another exception but we are not going to catch it |
||
retries += 1 | ||
if retries == 2: | ||
logger.debug(error, exc_info=True) | ||
raise ServiceResponseError("Failed to get manifest credentials.") | ||
|
||
return credential_dict | ||
|
||
@staticmethod | ||
def _get_oras_client(manifest_credentials: MutableMapping[str, Any]) -> OrasClient: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of questions:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.