Skip to content
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

Retry get instance view if only name property is present #3036

Merged
merged 3 commits into from
Feb 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tests_e2e/tests/lib/virtual_machine_extension_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#
# This module includes facilities to execute VM extension operations (enable, remove, etc).
#

import json
import uuid

from assertpy import assert_that, soft_assertions
Expand Down Expand Up @@ -134,8 +134,15 @@ def assert_instance_view(
If 'assert_function' is provided, it is invoked passing as parameter the instance view. This function can be used to perform
additional validations.
"""
# Sometimes we get incomplete instance view with only 'name' property which causes issues during assertions.
# Retry attempt to get instance view if only 'name' property is populated.
attempt = 1
instance_view = self.get_instance_view()
log.info("Instance view:\n%s", instance_view.serialize())
while instance_view.name is not None and instance_view.type_handler_version is None and instance_view.statuses is None and attempt < 3:
log.info("Instance view is incomplete: %s\nRetrying attempt to get instance view...", instance_view.serialize())
instance_view = self.get_instance_view()
attempt += 1
log.info("Instance view:\n%s", json.dumps(instance_view.serialize(), indent=4))

with soft_assertions():
if expected_version is not None:
Expand Down
Loading