-
Notifications
You must be signed in to change notification settings - Fork 30
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
feat: Add cloud version string #413
base: main
Are you sure you want to change the base?
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 |
---|---|---|
|
@@ -437,6 +437,10 @@ def clean(self) -> List[Exception]: | |
exceptions.append(e) | ||
return exceptions | ||
|
||
def version(self): | ||
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. Same, I'd cache this value somehow as it's unlikely to change on the host mid-test. |
||
"""LXD version.""" | ||
return subp(["lxd", "--version"]).rstrip() | ||
|
||
|
||
class LXDContainer(_BaseLXD): | ||
"""LXD Containers Cloud Class.""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -660,3 +660,12 @@ def clean(self) -> List[Exception]: | |
exceptions.append(e) | ||
|
||
return exceptions | ||
|
||
def version(self): | ||
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. @holmanb We should probably lru_cache this as it's unlikely to change mid integration test run, but it's something we don't want to recalculate any time we call it. |
||
"""Qemu version.""" | ||
return ( | ||
subprocess.run(self.qemu_binary, capture_output=True) | ||
.stdout.decode() | ||
.splitlines() | ||
.pop(0) | ||
) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -112,6 +112,8 @@ def test_public_api(cloud: BaseCloud): | |||||
# Not sure there's a great way to test this other than not raising | ||||||
cloud.image_serial(image_id) | ||||||
|
||||||
version = cloud.version() | ||||||
assert isinstance(version, str) or version is None | ||||||
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.
Suggested change
|
||||||
with cloud.launch(image_id=image_id, user_data=cloud_config) as instance: | ||||||
instance.wait() | ||||||
exercise_instance(instance) | ||||||
|
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.
Is there a lot of value in us returning None here instead of just an empty string ""? We can then avoid the Optional[str] handling for typing validation.
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.
I agree with chad. I don't think there is much benefit to returning a None instead of a falsey/empty string.