Commit be20c700 authored by Xavier Thompson's avatar Xavier Thompson

slapos/testing: Factor partition formating

Factor test partitions formatting into a separate method to facilitate
customising the formating step in tests that need to do so.
parent 55314ef1
...@@ -391,8 +391,7 @@ class SlapOSInstanceTestCase(unittest.TestCase): ...@@ -391,8 +391,7 @@ class SlapOSInstanceTestCase(unittest.TestCase):
max_retry=cls.instance_max_retry, debug=cls._debug) max_retry=cls.instance_max_retry, debug=cls._debug)
@classmethod @classmethod
def _setUpClass(cls): def formatPartitions(cls):
cls.slap.start()
cls.logger.debug( cls.logger.debug(
"Formatting to remove old partitions XXX should not be needed because we delete ..." "Formatting to remove old partitions XXX should not be needed because we delete ..."
) )
...@@ -402,12 +401,20 @@ class SlapOSInstanceTestCase(unittest.TestCase): ...@@ -402,12 +401,20 @@ class SlapOSInstanceTestCase(unittest.TestCase):
cls.partition_count, cls._ipv4_address, cls._ipv6_address, cls.partition_count, cls._ipv4_address, cls._ipv6_address,
getattr(cls, '__partition_reference__', '{}-'.format(cls.__name__))) getattr(cls, '__partition_reference__', '{}-'.format(cls.__name__)))
@classmethod
def _setUpClass(cls):
cls.slap.start()
# (re)format partitions
cls.formatPartitions()
# request # request
cls.requestDefaultInstance() cls.requestDefaultInstance()
# slapos node instance # slapos node instance
cls.logger.debug("Waiting for instance") cls.logger.debug("Waiting for instance")
cls.waitForInstance() cls.waitForInstance()
# expose some class attributes so that tests can use them: # expose some class attributes so that tests can use them:
# the main ComputerPartition instance, to use getInstanceParameterDict # the main ComputerPartition instance, to use getInstanceParameterDict
cls.computer_partition = cls.requestDefaultInstance() cls.computer_partition = cls.requestDefaultInstance()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment