Unit tests fail with: 'AnonymousUser' object has no attribute 'token'

Bug #1805240 reported by Boden R
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
networking-bgpvpn
Fix Committed
Undecided
Ivan Kolodyazhny

Bug Description

It appears the python UT jobs are failing with:

  AttributeError: 'AnonymousUser' object has no attribute 'token'

For example the no-op patch that results in failures [1][2].

[1] https://review.openstack.org/#/c/620098/
[2] http://logs.openstack.org/98/620098/1/check/openstack-tox-py27/717336c/job-output.txt.gz#_2018-11-26_18_48_04_271190

Revision history for this message
Akihiro Motoki (amotoki) wrote :

This happens in bgpvpn-dashboard test. I think some recent horizon change affects this, but I haven't checked it yet.

Revision history for this message
Elod Illes (elod-illes) wrote :

I think the change that causes this problem here is this bugfix in horizon: https://review.openstack.org/#/q/Ib9912090a87b716e7f5710f6f360b0df168ec2e3

Ivan Kolodyazhny (e0ne)
Changed in bgpvpn:
assignee: nobody → Ivan Kolodyazhny (e0ne)
Revision history for this message
Boden R (boden) wrote :
Revision history for this message
Elod Illes (elod-illes) wrote :

@boden: That patch removes the utils.patch_middleware_get_user() from the setUp method of APITestCase, I think that causes the problem in networking-bgpvpn tests. So that patch introduced this test failure in networking-bgpvpn.

If we simply add an import of the middleware monkeypatch ("from openstack_auth import middleware") in test_bgpvpn.py, then the tests run OK, but I don't know if that is enough. (Does this only affect the tests or do we need some fix (add the middleware?) to the bgpvpn dashboard code itself?)

Revision history for this message
Boden R (boden) wrote :

elod-illes I'm not familiar enough with the test/scenario to comment on the proper solution.
I do see that the no-op bgpvpn test patch https://review.openstack.org/#/c/620098/ is still failing. Perhaps someone needs to check with the dashboard team (or other).

It does appear the bgpvpn master gate has been broken for awhile, so I really hope someone can work towards a solution.

Ivan Kolodyazhny (e0ne)
Changed in bgpvpn:
status: New → Confirmed
Revision history for this message
Elod Illes (elod-illes) wrote :

Ivan proposed a solution that was merged in to horizon: https://review.openstack.org/#/c/621186/

Revision history for this message
Thomas Morin (tmmorin-orange) wrote :
Changed in bgpvpn:
status: Confirmed → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 15.0.0.0b2

This issue was fixed in the openstack/horizon 15.0.0.0b2 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 13.0.2

This issue was fixed in the openstack/horizon 13.0.2 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 14.0.3

This issue was fixed in the openstack/horizon 14.0.3 release.

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.