Commit d3676015 authored by Xavier Thompson's avatar Xavier Thompson

software/theia: Improve tests

parent 4a700e68
Pipeline #14187 failed with stage
in 0 seconds
...@@ -57,6 +57,22 @@ class TheiaTestCase(SlapOSInstanceTestCase): ...@@ -57,6 +57,22 @@ class TheiaTestCase(SlapOSInstanceTestCase):
# Theia uses unix sockets, so it needs short paths. # Theia uses unix sockets, so it needs short paths.
__partition_reference__ = 'T' __partition_reference__ = 'T'
@classmethod
def getPartitionIdWhere(cls, software_url, software_type):
for computer_partition in cls.slap.computer.getComputerPartitionList():
_software = computer_partition.getSoftwareRelease()._software_release
_type = computer_partition.getType()
if _software == software_url and _type == software_type:
return computer_partition.getId()
return None
@classmethod
def getPartitionPathWhere(cls, software_url, software_type):
Id = cls.getPartitionIdWhere(software_url, software_type)
if Id:
return os.path.join(cls.slap._instance_root, Id)
return None
# Utils # Utils
# ----- # -----
...@@ -263,7 +279,8 @@ class TestTheiaResilientInterface(TestTheiaInterface): ...@@ -263,7 +279,8 @@ class TestTheiaResilientInterface(TestTheiaInterface):
def setUpClass(cls): def setUpClass(cls):
super(TestTheiaResilientInterface, cls).setUpClass() super(TestTheiaResilientInterface, cls).setUpClass()
# Patch the computer root path to that of the export theia instance # Patch the computer root path to that of the export theia instance
cls.computer_partition_root_path = os.path.join(cls.slap._instance_root, "T2") path = cls.getPartitionPathWhere(cls.getSoftwareURL(), 'export')
cls.computer_partition_root_path = path
class TestTheiaResilientWithSR(TestTheiaWithSR): class TestTheiaResilientWithSR(TestTheiaWithSR):
...@@ -277,4 +294,5 @@ class TestTheiaResilientWithSR(TestTheiaWithSR): ...@@ -277,4 +294,5 @@ class TestTheiaResilientWithSR(TestTheiaWithSR):
def setUpClass(cls): def setUpClass(cls):
super(TestTheiaResilientWithSR, cls).setUpClass() super(TestTheiaResilientWithSR, cls).setUpClass()
# Patch the computer root path to that of the export theia instance # Patch the computer root path to that of the export theia instance
cls.computer_partition_root_path = os.path.join(cls.slap._instance_root, "T2") path = cls.getPartitionPathWhere(cls.getSoftwareURL(), 'export')
cls.computer_partition_root_path = path
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