Commit a3bd035b authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Łukasz Nowak

slapos.test.software: Emit more information in case of problems

Whenever there is a problem while building software or instantiation,
emit verbose information for further analysis.
parent 1dd583c8
...@@ -31,6 +31,7 @@ import socket ...@@ -31,6 +31,7 @@ import socket
import subprocess import subprocess
from contextlib import closing from contextlib import closing
import logging import logging
import StringIO
import json import json
from BaseHTTPServer import HTTPServer from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler from BaseHTTPServer import BaseHTTPRequestHandler
...@@ -164,20 +165,43 @@ class SlapOSInstanceTestCase(unittest.TestCase): ...@@ -164,20 +165,43 @@ class SlapOSInstanceTestCase(unittest.TestCase):
@classmethod @classmethod
def runSoftwareRelease(cls): def runSoftwareRelease(cls):
cls.software_status_dict = cls.slapos_controler.runSoftwareRelease(
cls.config, environment=os.environ) logger = logging.getLogger()
# TODO: log more details in this case logger.level = logging.DEBUG
assert cls.software_status_dict['status_code'] == 0 stream = StringIO.StringIO()
stream_handler = logging.StreamHandler(stream)
logger.addHandler(stream_handler)
try:
cls.software_status_dict = cls.slapos_controler.runSoftwareRelease(
cls.config, environment=os.environ)
stream.seek(0)
stream.flush()
assert cls.software_status_dict['status_code'] == 0, stream.read()
finally:
logger.removeHandler(stream_handler)
del stream
@classmethod @classmethod
def runComputerPartition(cls): def runComputerPartition(cls):
logger = logging.getLogger()
logger.level = logging.DEBUG
stream = StringIO.StringIO()
stream_handler = logging.StreamHandler(stream)
logger.addHandler(stream_handler)
instance_parameter_dict = cls.getInstanceParameterDict() instance_parameter_dict = cls.getInstanceParameterDict()
cls.instance_status_dict = cls.slapos_controler.runComputerPartition( try:
cls.instance_status_dict = cls.slapos_controler.runComputerPartition(
cls.config, cls.config,
cluster_configuration=instance_parameter_dict, cluster_configuration=instance_parameter_dict,
environment=os.environ) environment=os.environ)
# TODO: log more details in this case stream.seek(0)
assert cls.instance_status_dict['status_code'] == 0 stream.flush()
assert cls.instance_status_dict['status_code'] == 0, stream.read()
finally:
logger.removeHandler(stream_handler)
del stream
# FIXME: similar to test node, only one (root) partition is really # FIXME: similar to test node, only one (root) partition is really
# supported for now. # supported for now.
......
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