Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
17
Merge Requests
17
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
d52ef85a
Commit
d52ef85a
authored
Jun 15, 2018
by
Guillaume Hervier
Committed by
Rafael Monnerat
Jul 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapgrid_tests: Add base test for portredir manager
parent
24b2e6e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
slapos/tests/slapgrid.py
slapos/tests/slapgrid.py
+39
-0
No files found.
slapos/tests/slapgrid.py
View file @
d52ef85a
...
...
@@ -2732,3 +2732,42 @@ exit 1 # do not proceed trying to use this software
['/buildingSoftwareRelease', '/softwareReleaseError'])
self.assertNotIn("
file
descriptors
:
leaked
", software.error_log)
self.assertIn("
file
descriptors
:
ok
", software.error_log)
class TestSlapgridWithPortRedirection(MasterMixin, unittest.TestCase):
def test_partition_instance_with_port_redirection(self):
manager_list = slapmanager.from_config({'manager_list': 'portredir'})
self.grid._manager_list = manager_list
computer = ComputerForTest(self.software_root, self.instance_root)
with httmock.HTTMock(computer.request_handler):
partition = computer.instance_list[0]
port_redirect_path = os.path.join(partition.partition_path,
slapmanager.portredir.Manager.port_redirect_filename)
with open(port_redirect_path, 'w+') as f:
port_redirects = [
{
'srcPort': 1234,
'destPort': 4321,
'destAddress': '127.0.0.1',
},
]
json.dump(port_redirects, f)
partition.requested_state = 'started'
partition.software.setBuildout(WRAPPER_CONTENT)
self.assertEqual(self.grid.processComputerPartitionList(), slapgrid.SLAPGRID_SUCCESS)
self.assertEqual(computer.sequence,
['/getFullComputerInformation', '/availableComputerPartition',
'/startedComputerPartition'])
self.assertEqual(partition.state, 'started')
# Check the socat command
partition_supervisord_config_path = os.path.join(self.instance_root,
'etc/supervisord.conf.d/0.conf')
with open(partition_supervisord_config_path) as f:
partition_supervisord_config = f.read()
self.assertTrue('socat-{}'.format(1234) in partition_supervisord_config)
self.assertTrue('socat TCP4-LISTEN:1234,fork TCP4:127.0.0.1:4321' in partition_supervisord_config)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment