Mis-formatted calls to log.* are not detected in unit tests

Bug #1503086 reported by John L. Villalovos
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
In Progress
Medium
Unassigned
ironic-python-agent
In Progress
Medium
Unassigned

Bug Description

For example:
https://review.openstack.org/231140

This is not being caught by the unit tests.

Currently unsure why. But a related bug is here: https://bugs.launchpad.net/python-fixtures/+bug/1503049

Did fix the fixtures bug but still does not fail unit tests when using patched fixtures.

Revision history for this message
Dmitry Tantsur (divius) wrote :

Hi! This is a valid bug, but it's not a bug in ironic, so I suggest we track it in #1503049

Revision history for this message
John L. Villalovos (happycamp) wrote :

I don't believe this is a duplicate. I have patched fixtures to report the exception but I still can't get log messages to fail.

Changed in ironic:
assignee: nobody → John L. Villalovos (happycamp)
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
John L. Villalovos (happycamp) wrote :

In my testing, the fake logger does not seem to be getting used during the Ironic unit tests. So I am confused.

In particular I was trying:
tox -v -v -epy27 -- -r 'test_configure_local_boot$' --serial

And did some hacking to fixtures/_fixtures/logger.py to have it write to files when the FakeLogger gets used. I only see one use of it and that appears to be for alembic.

Will continue to troubleshoot.

Revision history for this message
John L. Villalovos (happycamp) wrote :

One thing I noticed is that when doing:
$ tox -v -v -epy27 -- -r 'test_configure_local_boot$' --serial

The LOG does not have the FakeLogger as a handler.

I discovered this by doing a:
  raise ValueError(LOG.handlers)

in the called function.

My suspicion is that doing logger.getlogger(__name__) gets a different logger.

But even when I setup the FakeLogger, I still don't get a failure. I started doing some pdb work on it and will continue tomorrow.

Revision history for this message
John L. Villalovos (happycamp) wrote :

Comment 4 was a red herring. Actually tracked it down to something else. I have submitted a patch.

Revision history for this message
John L. Villalovos (happycamp) wrote :
Changed in ironic:
assignee: John L. Villalovos (happycamp) → nobody
Ruby Loo (rloo)
Changed in ironic:
status: In Progress → Confirmed
Joanna Taryma (jtaryma)
Changed in ironic:
assignee: nobody → Joanna Taryma (jtaryma)
Joanna Taryma (jtaryma)
Changed in ironic:
assignee: Joanna Taryma (jtaryma) → nobody
Changed in ironic:
status: Confirmed → Triaged
Changed in ironic:
assignee: nobody → John L. Villalovos (happycamp)
status: Triaged → In Progress
Changed in ironic-python-agent:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → John L. Villalovos (happycamp)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic-python-agent (master)

Fix proposed to branch: master
Review: https://review.openstack.org/511066

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on ironic (master)

Change abandoned by "John L. Villalovos <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/ironic/+/232257

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on ironic-python-agent (master)

Change abandoned by "John L. Villalovos <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/ironic-python-agent/+/511066

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by "Jay Faulkner <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/ironic-python-agent/+/511066
Reason: this needs more than a rebase, and I don't have time to attack it

Changed in ironic:
assignee: John L. Villalovos (happycamp) → nobody
Changed in ironic-python-agent:
assignee: John L. Villalovos (happycamp) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.