<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">+1 to a fixture for the middleware if this is a common practice to do unit testing in this manner. The main issue here was mocking out the cache and using a hand-crafted “valid” token.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">We have a mechanism provided in the keystone client library that allows for creating a valid token (all the required fields, etc): <a href="https://github.com/openstack/python-keystoneclient/blob/master/keystoneclient/fixture/v3.py#L48">https://github.com/openstack/python-keystoneclient/blob/master/keystoneclient/fixture/v3.py#L48</a> for example.</div> <div id="bloop_sign_1401484085318639872" class="bloop_sign"><p><strong>—</strong><br><strong>Morgan Fainberg</strong></p></div> <div style="color:black"><br>From: <span style="color:black">Doug Hellmann</span> <a href="mailto:doug.hellmann@dreamhost.com">doug.hellmann@dreamhost.com</a><br>Reply: <span style="color:black">OpenStack Development Mailing List (not for usage questions)</span> <a href="mailto:openstack-dev@lists.openstack.org">openstack-dev@lists.openstack.org</a><br>Date: <span style="color:black">May 30, 2014 at 14:08:16</span><br>To: <span style="color:black">OpenStack Development Mailing List (not for usage questions)</span> <a href="mailto:openstack-dev@lists.openstack.org">openstack-dev@lists.openstack.org</a><br>Subject: <span style="color:black"> Re: [openstack-dev] [Keystone] [Blazar] [Ironic] Py26/27 gates failing because of keystoneclient-0.9.0 <br></span></div><br> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>Would it make sense to provide a test fixture in the middleware<br>library for projects who want or need to test with token management?<br><br>Doug<br><br>On Fri, May 30, 2014 at 12:49 PM, Brant Knudson <blk@acm.org> wrote:<br>><br>> The auth_token middleware changed recently[1] to check if tokens retrieved<br>> from the cache are expired based on the expiration time in the token. The<br>> unit tests for Blazar, Ceilometer, and Ironic are all using a copy-pasted<br>> fake memcache implementation that's supposed to simulate what auth_token<br>> stores in the cache, but the tokens that it had stored weren't valid. Tokens<br>> have an expiration time in them and these ones didn't. I don't think that<br>> it's safe for test code to make assumptions about how the auth_token<br>> middleware is going to store data in its cache. The format of the cached<br>> data isn't part of the public interface. It's changed before, when<br>> expiration times changed from *nix timestamps to iso 8601 formatted dates.<br>><br>> After looking at this, I proposed a couple of changes to the auth_token<br>> middleware. One is to have auth_token use the expiration time it has cached<br>> and fail the auth request if the token is expired according to the cache. It<br>> doesn't have to check the token's expiration time because it was stored as<br>> part of the cache data. The other is to make cached token handling more<br>> efficient by not checking the token expiration time if the token was cached.<br>><br>> [1]<br>> http://git.openstack.org/cgit/openstack/python-keystoneclient/commit/keystoneclient/middleware/auth_token.py?id=8574256f9342faeba2ce64080ab5190023524e0a<br>> [2] https://review.openstack.org/#/c/96786/<br>><br>> - Brant<br>><br>><br>><br>> On Fri, May 30, 2014 at 7:11 AM, Sylvain Bauza <sbauza@redhat.com> wrote:<br>>><br>>> Le 30/05/2014 14:07, Dina Belova a écrit :<br>>><br>>> I did not look close to this concrete issue, but in the ceilometer there<br>>> is almost the same thing: https://bugs.launchpad.net/ceilometer/+bug/1324885<br>>> and fixes were already provided.<br>>><br>>> Will this help Blazar?<br>>><br>>><br>>> Got the Ironic patch as well :<br>>><br>>> https://review.openstack.org/#/c/96576/1/ironic/tests/api/utils.py<br>>><br>>> Will provide a patch against Blazar.<br>>><br>>> Btw, I'll close the bug.<br>>><br>>><br>>> -- Dina<br>>><br>>><br>>> On Fri, May 30, 2014 at 4:00 PM, Sylvain Bauza <sbauza@redhat.com> wrote:<br>>>><br>>>> Hi Keystone developers,<br>>>><br>>>> I just opened a bug [1] because Ironic and Blazar (ex. Climate) patches<br>>>> are failing due to a new release in Keystone client which seems to<br>>>> regress on midleware auth.<br>>>><br>>>> Do you have any ideas on if it's quick to fix, or shall I provide a<br>>>> patch to openstack/global-requirements.txt to only accept keystoneclient<br>>>> < 0.9.0 ?<br>>>><br>>>> Thanks,<br>>>> -Sylvain<br>>>><br>>>><br>>>> _______________________________________________<br>>>> OpenStack-dev mailing list<br>>>> OpenStack-dev@lists.openstack.org<br>>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev<br>>><br>>><br>>><br>>><br>>> --<br>>><br>>> Best regards,<br>>><br>>> Dina Belova<br>>><br>>> Software Engineer<br>>><br>>> Mirantis Inc.<br>>><br>>><br>>><br>>> _______________________________________________<br>>> OpenStack-dev mailing list<br>>> OpenStack-dev@lists.openstack.org<br>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev<br>>><br>><br>><br>> _______________________________________________<br>> OpenStack-dev mailing list<br>> OpenStack-dev@lists.openstack.org<br>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev<br>><br><br>_______________________________________________<br>OpenStack-dev mailing list<br>OpenStack-dev@lists.openstack.org<br>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev<br></div></div></span></blockquote></body></html>