Skip to content

Commit

Permalink
testlib: when provisioning VMs allow to keep the original machine_class
Browse files Browse the repository at this point in the history
This use case is becoming now valid in the anaconda repository, where we
overwrite the machine_class for running the VMs from ISO, however we
will need to start provisioning 'normal' cloud VMs, to act as servers
for network storage; see iscsi.
  • Loading branch information
KKoukiou committed Oct 19, 2023
1 parent 6a5b725 commit c4aea73
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/common/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1276,8 +1276,12 @@ 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):
if inherit_machine_class:
machine_class = self.machine_class
else:
machine_class = testvm.VirtMachine

if opts.address:
if forward:
raise unittest.SkipTest("Cannot run this test when specific machine address is specified")
Expand All @@ -1289,8 +1293,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

0 comments on commit c4aea73

Please sign in to comment.