[stestr][tempest] how to conf test suite to get file_name to be pythonlogging instead of stdout

Matthew Treinish mtreinish at kortar.org
Wed Jan 22 20:42:40 UTC 2020


On Wed, Jan 22, 2020 at 05:29:16PM +0000, SCHVENINGER, DOUGLAS P wrote:
> When using stestr we are seeing
> 
>   1.  different file_name for logging statement
>   2.  mime type on one test suite run and not the other test suite run
>   3.  test_id on all log statement in one test suite run but missing on some of the log statement from the other test suite run
> 
> I was wondering if anyone has any input of how to config our internal test suite like tempest to get correct data to show up

It's hard to know exactly what's going on without seeing your internal test
suite. But, tempest isn't doing anything special with regards to the
attachments. Tempest just uses fixtures (https://github.com/testing-cabal/fixtures)
to setup streams from stdout, stderr, and python logging, see:
https://opendev.org/openstack/tempest/src/branch/master/tempest/test.py#L619-L631
Testtool's TestCase useFixture() method:
https://github.com/testing-cabal/testtools/blob/f51ce5f934153e80d3e8a95b52e1464daeb30c14/testtools/testcase.py#L725-L765
handles attaching the stream from the fixture to the attachment as an
addCleanup() call (instead of using addDetails() it directly appends
it to the TestCase.__details dictionary). If your test suite is
missing metadata from these attachments I'd look at how you're
generating them and the method you're using them to attach to
the output stream.

> 
> When we run tempest with stestr the subunit stream is placing all logging data with a test_id and the file_name being pythonlogging.

From the stestr perspective it's not doing anything beside passing the subunit
stream emitted by the test runner (either
https://github.com/mtreinish/stestr/tree/master/stestr/subunit_runner on py>=3.5
or https://github.com/testing-cabal/subunit/blob/master/python/subunit/run.py
on py<3.5). So the answer to this question really relies on how you're generating
the attachments in the test suite itself.

Also, the subunit v2 format is binary and is very hard to read in an email.
I couldn't parse what you pasted (which is why I snipped it). If you want to
send the file I'd recommend using an attachment then I can parse the output
via tools that can handle the subunit v2 input.

Thanks,

Matthew Treinish
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20200122/2b33ab38/attachment-0001.sig>


More information about the openstack-discuss mailing list