[openstack-qa] console output handling in tempest

Christopher Yeoh cyeoh at au1.ibm.com
Fri Jan 25 06:21:11 UTC 2013


Hi,

I've been debugging an error that pops up in the tempest test errors occasionally:

======================================================================
FAIL: tempest.tests.compute.servers.test_console_output.ConsoleOutputTestXML.test_get_console_output
tags: worker-0
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/stack/tempest/tempest/tests/compute/servers/test_console_output.py", line 60, in test_get_console_output
    self.wait_for(get_output)
  File "/opt/stack/tempest/tempest/tests/compute/base.py", line 230, in wait_for
    condition()
  File "/opt/stack/tempest/tempest/tests/compute/servers/test_console_output.py", line 58, in get_output
    self.assertEqual(lines, 10)
AssertionError: 12 != 10

I had originally thought it was a parallel testing error, but it also turns up 
when the tests are run serially if the system is slow. The test attempts to get
get the last 10 lines of console output. Depending on how long the instance takes
to boot it can get different output. It fails when the output looks like this:

================START====================
 WARN: /etc/rc3.d/S99-cloud-userdata failed^M
  ____               ____  ____^M
 / __/ __ ____ ____ / __ \/ __/^M
/ /__ / // __// __// /_/ /\ \ ^M
\___//_//_/  /_/   \____/___/ ^M
 http://launchpad.net/cirros^M
^M
^M^M
login as 'cirros' user. default password: 'cubswin:)'. use 'sudo' for root.^M
cirros login: 
==================END================

I've replicated the carriage returns (^M) manually so email programs don't eat
them and make them invisible or convert them.

The JSON version of the test passes, but the XML version fails because when lxml/etree
is used to convert the output and it finds a ^M without a corresponding line feed it 
converts it into an addition LF. Thus there are 12 lines of console output rather than.

The easy way to fix this is just to strip the ^M characters in the
ConsoleOutputsClientXML tempest class. But I was wondering if there
is a better way to fix this by getting lxml/etree to be a bit smarter?

Also I'm wondering if the nova api should just be stripping ^M characters
before sending the console output to the clients - it does strip some 
already

        # XML output is not correctly escaped, so remove invalid characters
        remove_re = re.compile('[\x00-\x08\x0B-\x0C\x0E-\x1F]')

Thoughts anyone?

Regards,

Chris
-- 
cyeoh at au.ibm.com




More information about the openstack-qa mailing list