Commit 2638f574 authored by Marco Mariani's avatar Marco Mariani

tests: do not rotate supervisor logs when testing

parent 24451a06
......@@ -53,6 +53,9 @@ from slapos.grid.watchdog import getWatchdogID
REQUIRED_COMPUTER_PARTITION_PERMISSION = 0o750
# XXX not very clean. this is changed when testing
PROGRAM_PARTITION_TEMPLATE = pkg_resources.resource_stream(__name__,
'templates/program_partition_supervisord.conf.in').read()
class Software(object):
"""This class is responsible for installing a software release"""
......@@ -343,11 +346,9 @@ class Partition(object):
def addServiceToGroup(self, partition_id,
runner_list, path, extension=''):
uid, gid = self.getUserGroupId()
program_partition_template = pkg_resources.resource_stream(__name__,
'templates/program_partition_supervisord.conf.in').read()
for runner in runner_list:
self.partition_supervisor_configuration += '\n' + \
program_partition_template % {
PROGRAM_PARTITION_TEMPLATE % {
'program_id': '_'.join([partition_id, runner]),
'program_directory': self.instance_path,
'program_command': os.path.join(path, runner),
......
......@@ -47,6 +47,7 @@ from slapos.grid import slapgrid
from slapos.cli_legacy.slapgrid import parseArgumentTupleAndReturnSlapgridObject
from slapos.grid.utils import md5digest
from slapos.grid.watchdog import Watchdog, getWatchdogID
from slapos.grid import SlapObject
dummylogger = logging.getLogger()
......@@ -132,6 +133,29 @@ class BasicMixin:
slapos.grid.utils.bootstrapBuildout = dummy
SlapObject.PROGRAM_PARTITION_TEMPLATE = textwrap.dedent("""\
[program:%(program_id)s]
directory=%(program_directory)s
command=%(program_command)s
process_name=%(program_name)s
autostart=false
autorestart=false
startsecs=0
startretries=0
exitcodes=0
stopsignal=TERM
stopwaitsecs=60
stopasgroup=true
killasgroup=true
user=%(user_id)s
group=%(group_id)s
serverurl=AUTO
redirect_stderr=true
stdout_logfile=%(instance_path)s/.%(program_id)s.log
stderr_logfile=%(instance_path)s/.%(program_id)s.log
environment=USER="%(USER)s",LOGNAME="%(USER)s",HOME="%(HOME)s"
""")
def launchSlapgrid(self, develop=False):
self.setSlapgrid(develop=develop)
return self.grid.processComputerPartitionList()
......@@ -608,7 +632,7 @@ chmod 755 etc/run/wrapper
self.assertEqual(self.launchSlapgrid(), slapgrid.SLAPGRID_SUCCESS)
self.assertItemsEqual(os.listdir(self.instance_root), ['0', 'etc', 'var'])
self.assertItemsEqual(os.listdir(instance.partition_path),
['.0_wrapper.log', '.0_wrapper.log.1', 'buildout.cfg', 'etc', 'software_release', 'worked'])
['.0_wrapper.log', 'buildout.cfg', 'etc', 'software_release', 'worked'])
tries = 50
expected_text = 'Signal handler called with signal 15'
while tries > 0:
......@@ -680,7 +704,7 @@ exit 1
self.assertItemsEqual(os.listdir(self.instance_root),
['0', 'etc', 'var'])
self.assertItemsEqual(os.listdir(instance.partition_path),
['.0_wrapper.log', '.0_wrapper.log.1', 'buildout.cfg', 'etc', 'software_release', 'worked'])
['.0_wrapper.log', 'buildout.cfg', 'etc', 'software_release', 'worked'])
tries = 50
expected_text = 'Signal handler called with signal 15'
while tries > 0:
......
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