[stestr][tempest] how to conf test suite to get file_name to be pythonlogging instead of stdout
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 When we run tempest with stestr the subunit stream is placing all logging data with a test_id and the file_name being pythonlogging. Example sec record 2 below: Record 1 worker-00Mùϳ/àPÈ^'K‡ôoW�@{tempest.api.compute.flavors.test_flavors.FlavorsV2TestJSON.test_list_flavors[id-e36c0eaa-dff5-4082-ad1f-3f9a80aa3f59,smoke] Record 2 worker-0text/plain; charset="utf8"pythonlogging:''P�2020-01-21 19:05:43,639 142 INFO [tempest.lib.common.rest_client] Request (FlavorsV2TestJSON:test_list_flavors): 200 GET https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/... 0.468s 2020-01-21 19:05:43,639 142 DEBUG [tempest.lib.common.rest_client] Request - Headers: {'Content-Type': 'application/json', 'Accept': 'application/json', 'X-OpenStack-Nova-API-Version': '2.1', 'X-Auth-Token': '<omitted>'} Body: None Response - Headers: {'date': 'Tue, 21 Jan 2020 19:05:43 GMT', 'content-type': 'application/json', 'content-length': '4244', 'connection': 'close', 'vary': 'X-OpenStack-Nova-API-Version', 'x-content-type-options': 'nosniff', 'strict-transport-security': 'max-age=15724800; includeSubDomains', 'content-security-policy': "script-src 'self'; object-src 'self'", 'x-frame-options': 'DENY', 'x-permitted-cross-domain-policies': 'none', 'x-xss-protection': '1; mode=block', 'openstack-api-version': 'compute 2.1', 'x-openstack-nova-api-version': '2.1', 'x-openstack-request-id': 'req-160e3fc6-d568-457d-9cbd-f6670b652565', 'x-compute-request-id': 'req-160e3fc6-d568-457d-9cbd-f6670b652565', 'status': '200', 'content-location': 'https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/flavors'} Body: b'{"flavors": [{"id": "5f112417-533d-4e33-b9d7-ca8237a29a83", "name": "m1.xlarge", "links": [{"rel": "self", "href": "https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/flavors/5f112417-533d-4e33-b9d7-ca8237a29a83"}, {"rel": "bookmark", "href": "https://compute-nc.auk51a.cci.att.com/8695795f8370474d9d628b3cdd9f97cb/flavors/5f112417-533d-4e33-b9d7-ca8237a29a83"}]}, {"id": "877ef018-6134-4d61-ba6b-d40ee58eb6be", "name": "aqa.alt20200121T190526948874", "links": [{"rel": "self", "href": "https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/flavors/877ef018-6134-4d61-ba6b-d40ee58eb6be"}, {"rel": "bookmark", "href": "https://compute-nc.auk51a.cci.att.com/8695795f8370474d9d628b3cdd9f97cb/flavors/877ef018-6134-4d61-ba6b-d40ee58eb6be"}]}, {"id": "910d1836-119b-4ecf-9d47-3ef7e5990fad", "name": "aqa.primary20200121T185150095917", "links": [{"rel": "self", "href": "https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/flavors/910d1836-119b-4ecf-9d47-3ef7e5990fad"}, {"rel": "bookmark", "href": "https://compute-nc.auk51a.cci.att.com/8695795f8370474d9d628b3cdd9f97cb/flavors/910d1836-119b-4ecf-9d47-3ef7e5990fad"}]}, {"id": "bd850da7-a2d8-48e8-bd42-3378abae556a", "name": "aqa.primary20200121T190526948874", "links": [{"rel": "self", "href": "https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/flavors/bd850da7-a2d8-48e8-bd42-3378abae556a"}, {"rel": "bookmark", "href": "https://compute-nc.auk51a.cci.att.com/8695795f8370474d9d628b3cdd9f97cb/flavors/bd850da7-a2d8-48e8-bd42-3378abae556a"}]}, {"id": "c6653cba-3cbd-48bd-aa3e-54366bded2b4", "name": "m1.small", "links": [{"rel": "self", "href": "https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/flavors/c6653cba-3cbd-48bd-aa3e-54366bded2b4"}, {"rel": "bookmark", "href": "https://compute-nc.auk51a.cci.att.com/8695795f8370474d9d628b3cdd9f97cb/flavors/c6653cba-3cbd-48bd-aa3e-54366bded2b4"}]}, {"id": "cdb15fe3-66a6-46cb-ab97-b26cc37b6d7f", "name": "m1.medium", "links": [{"rel": "self", "href": "https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/flavors/cdb15fe3-66a6-46cb-ab97-b26cc37b6d7f"}, {"rel": "bookmark", "href": "https://compute-nc.auk51a.cci.att.com/8695795f8370474d9d628b3cdd9f97cb/flavors/cdb15fe3-66a6-46cb-ab97-b26cc37b6d7f"}]}, {"id": "dcc5d1ea-d15a-476e-8587-29bd34e36051", "name": "m1.large", "links": [{"rel": "self", "href": "https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/flavors/dcc5d1ea-d15a-476e-8587-29bd34e36051"}, {"rel": "bookmark", "href": "https://compute-nc.auk51a.cci.att.com/8695795f8370474d9d628b3cdd9f97cb/flavors/dcc5d1ea-d15a-476e-8587-29bd34e36051"}]}, {"id": "e43ea269-f785-48f1-a05e-edffae5d5a85", "name": "taas-p1.c2r4d50", "links": [{"rel": "0ËUùƳ/ðMg^'K‡ôoW�@{tempest.api.compute.flavors.test_flavors.FlavorsV2TestJSON.test_list_flavors[id-e36c0eaa-dff5-4082-ad1f-3f9a80aa3f59,smoke] Record 3 worker-0text/plain; charset="utf8"pythonlogging:''LŸself", "href": "https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/flavors/e43ea269-f785-48f1-a05e-edffae5d5a85"}, {"rel": "bookmark", "href": "https://compute-nc.auk51a.cci.att.com/8695795f8370474d9d628b3cdd9f97cb/flavors/e43ea269-f785-48f1-a05e-edffae5d5a85"}]}, {"id": "eef05014-3e5f-4ea5-bbfa-8171c2e2707b", "name": "aqa.alt20200121T185150095917", "links": [{"rel": "self", "href": "https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/flavors/eef05014-3e5f-4ea5-bbfa-8171c2e2707b"}, {"rel": "bookmark", "href": "https://compute-nc.auk51a.cci.att.com/8695795f8370474d9d628b3cdd9f97cb/flavors/eef05014-3e5f-4ea5-bbfa-8171c2e2707b"}]}, {"id": "f1a3141db37c48e49bd84e90d1c1369e", "name": "p1.c5r1.0d10s1.0e10", "links": [{"rel": "self", "href": "https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/flavors/f1a3141db37c48e49bd84e90d1c1369e"}, {"rel": "bookmark", "href": "https://compute-nc.auk51a.cci.att.com/8695795f8370474d9d628b3cdd9f97cb/flavors/f1a3141db37c48e49bd84e90d1c1369e"}]}, {"id": "f3da4ca8-f8df-44f8-8a06-832bca480234", "name": "m1.tiny", "links": [{"rel": "self", "href": "https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/flavors/f3da4ca8-f8df-44f8-8a06-832bca480234"}, 2020-01-21 19:05:43,878 142 INFO [tempest.lib.common.rest_client] Request (FlavorsV2TestJSON:test_list_flavors): 200 GET https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/... 0.236s 2020-01-21 19:05:43,878 142 DEBUG [tempest.lib.common.rest_client] Request - Headers: {'Content-Type': 'application/json', 'Accept': 'application/json', 'X-OpenStack-Nova-API-Version': '2.1', 'X-Auth-Token': '<omitted>'} Body: None Response - Headers: {'date': 'Tue, 21 Jan 2020 19:05:43 GMT', 'content-type': 'application/json', 'content-length': '581', 'connection': 'close', 'vary': 'X-OpenStack-Nova-API-Version', 'x-content-type-options': 'nosniff', 'strict-transport-security': 'max-age=15724800; includeSubDomains', 'content-security-policy': "script-src 'self'; object-src 'self'", 'x-frame-options': 'DENY', 'x-permitted-cross-domain-policies': 'none', 'x-xss-protection': '1; mode=block', 'openstack-api-version': 'compute 2.1', 'x-openstack-nova-api-version': '2.1', 'x-openstack-request-id': 'req-38380cca-ecaf-4fb5-a768-cc91172ccbff', 'x-compute-request-id': 'req-38380cca-ecaf-4fb5-a768-cc91172ccbff', 'status': '200', 'content-location': 'https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/flavors/bd850da7-a2d8-48e8-bd42-3378abae556a'} Body: b'{"flavor": {"id": "bd850da7-a2d8-48e8-bd42-3378abae556a", "name": "aqa.primary20200121T190526948874", "ram": 1024, "disk": 5, "swap": "", "OS-FLV-EXT-DATA:ephemeral": 0, "OS-FLV-DISABLED:disabled": false, "vcpus": 1, "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "links": [{"rel": "self", "href": "https://compute-nc.auk51a.cci.att.com/v2.1/8695795f8370474d9d628b3cdd9f97cb/flavors/bd850da7-a2d8-48e8-bd42-3378abae556a"}, {"rel": "bookmark", "href": "https://compute-nc.auk51a.cci.att.com/8695795f8370474d9d628b3cdd9f97cb/flavors/bd850da7-a2d8-48e8-bd42-3378abae556a"}]}}' 0£Õ8d³/ƒ@š^'K‡ôoW�@{tempest.api.compute.flavors.test_flavors.FlavorsV2TestJSON.test_list_flavors[id-e36c0eaa-dff5-4082-ad1f-3f9a80aa3f59,smoke] When we run our internal test suite with stestr the subunit stream is placing all logging data sometime with a test_id and the file_name being stdout. Example sec record 2 below: Record 1 process config logging to file_name stdout �'�@�^(�R����worker-0stdout@�2020-01-22 11:24:34.681 24600 INFO aic_aqa_infrastructure_sonobuoy_plugins.host_info.config [-] Config and Logging setup by aic_aqa_infrastructure_sonobuoy_plugins.host_info.config Config data following in DEBUG 0��..�'�B^^(�R�z��worker-0stdoutB82020-01-22 11:24:34.742 24600 INFO aic_aqa_infrastructure_sonobuoy_plugins.common.expected.base [-] Loaded ExpectedData source file: requirements from: /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/host_info/expected/data/requirements.yaml 2020-01-22 11:24:34.744 24600 INFO aic_aqa_infrastructure_sonobuoy_plugins.common.expected.base [-] Loaded ExpectedData source file: site from: /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/host_info/expected/data/site.yaml 0q���'�A@^(�R�'��worker-0stdoutA2020-01-22 11:24:34.819 24600 INFO aic_aqa_infrastructure_sonobuoy_plugins.common.expected.base [-] Loaded ExpectedData source file: default from: /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/host_info/expected/data/default.yaml 0��'�BP^(�S^�worker-0stdoutB*2020-01-22 11:24:35.260 24600 DEBUG aic_aqa_infrastructure_sonobuoy_plugins.common.utils.host_info_utils [-] file mount point /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/tests/functional/data/host with path /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/tests/functional/data/host/etc/rsyslog.d/40-sensage.conf get_host_mount /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/common/utils/host_info_utils.py:18 Record 2 test case exists event 0#l'��/�@�^(�S�#)H@|aic_aqa_infrastructure_sonobuoy_plugins.host_info.tests.network.test_calico_logs.TestCalicoLogs.test_flow_log_file_retentionworker-00��� �'�E^(�S�� ________________________________ `worker-0stdoutD�2020-01-22 11:24:35.290 24600 DEBUG aic_aqa_infrastructure_sonobuoy_plugins.common.utils.host_info_utils [-] file mount point /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/tests/functional/data/host with path /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/tests/functional/data/host/etc/hostname get_host_mount /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/common/utils/host_info_utils.py:18 2020-01-22 11:24:35.291 24600 DEBUG aic_aqa_infrastructure_sonobuoy_plugins.common.actuals.commands.base_command [-] Executing command: cat /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/tests/functional/data/host/etc/hostname __init__ /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/common/actuals/commands/base_command.py:31 2020-01-22 11:24:35.298 24600 INFO aic_aqa_infrastructure_sonobuoy_plugins.host_info.tests.test_base [-] Use environment file point /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/tests/functional/data/controller-describe-node.json to describe node. 0�j}��'�D�^(�S��worker-0stdoutD�2020-01-22 11:24:35.342 24600 DEBUG aic_aqa_infrastructure_sonobuoy_plugins.common.utils.host_info_utils [-] file mount point /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/tests/functional/data/host with path /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/tests/functional/data/host/var/log/calico/flowlogs get_host_mount /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/common/utils/host_info_utils.py:18 2020-01-22 11:24:35.343 24600 DEBUG aic_aqa_infrastructure_sonobuoy_plugins.common.utils.host_info_utils [-] file mount point /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/tests/functional/data/host with path /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/tests/functional/data/host/var/log/calico/audit get_host_mount /home/ds6901/aic-aqa-infrastructure-sonobuoy-plugins/aic_aqa_infrastructure_sonobuoy_plugins/common/utils/host_info_utils.py:18 2020-01-22 11:24:35.345 24600 INFO aic_aqa_infrastructure_sonobuoy_plugins.host_info.tests.network.test_calico_logs [-] Class setup logging Record 3 test case in progress with test_id 0ŋ �/�@�^(�Sԗ&@|aic_aqa_infrastructure_sonobuoy_plugins.host_info.tests.network.test_calico_logs.TestCalicoLogs.test_flow_log_file_retentionworker-0 Record 4 log statements from the test case method but no test_id and file_name=stdout 0���Q�'�A�^(�S�a ________________________________ worker-0stdoutA�2020-01-22 11:24:35.350 24600 INFO aic_aqa_infrastructure_sonobuoy_plugins.host_info.tests.network.test_calico_logs [-] Sample log message 1 2020-01-22 11:24:35.358 24600 INFO aic_aqa_infrastructure_sonobuoy_plugins.host_info.tests.network.test_calico_logs [-] Sample log message 2 2020-01-22 11:24:35.359 24600 INFO aic_aqa_infrastructure_sonobuoy_plugins.host_info.tests.network.test_calico_logs [-] Sample log message 3 0�K��/�@�^(�S�n�0@|aic_aqa_infrastructure_sonobuoy_plugins.host_info.tests.network.test_calico_logs.TestCalicoLogs.test_flow_log_file_retentionworker-00N}� Thanks in advance for any help on this. Doug Schveninger Lead Software Engineer douglas.schveninger@att.com<mailto:douglas.schveninger@att.com> Office: (314) 450-3311
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... Testtool's TestCase useFixture() method: https://github.com/testing-cabal/testtools/blob/f51ce5f934153e80d3e8a95b52e1... 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
participants (2)
-
Matthew Treinish
-
SCHVENINGER, DOUGLAS P