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

testlib: when provisioning VMs allow to keep the original machine_class #19510

Merged
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
7 changes: 3 additions & 4 deletions test/common/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1276,8 +1276,9 @@ def kill_global_machine(cls):
def label(self):
return self.__class__.__name__ + '-' + self._testMethodName

def new_machine(self, image=None, forward=None, restrict=True, cleanup=True, **kwargs):
machine_class = self.machine_class
def new_machine(self, image=None, forward=None, restrict=True, cleanup=True, inherit_machine_class=True, **kwargs):
machine_class = inherit_machine_class and self.machine_class or testvm.VirtMachine

if opts.address:
if forward:
raise unittest.SkipTest("Cannot run this test when specific machine address is specified")
Expand All @@ -1289,8 +1290,6 @@ def new_machine(self, image=None, forward=None, restrict=True, cleanup=True, **k
image = os.path.join(TEST_DIR, "images", self.image)
if not os.path.exists(image):
raise FileNotFoundError("Can't run tests without a prepared image; use test/image-prepare")
if not machine_class:
machine_class = testvm.VirtMachine
if not self.network:
network = testvm.VirtNetwork(image=image)
if cleanup:
Expand Down