Thursday, 2020-11-12

*** evrardjp has quit IRC05:33
*** evrardjp has joined #openstack-placement05:33
*** martinkennelly has joined #openstack-placement09:26
*** sean-k-mooney1 has joined #openstack-placement09:42
*** sean-k-mooney has quit IRC09:43
*** zzzeek has quit IRC09:45
*** zzzeek has joined #openstack-placement09:46
*** zzzeek has quit IRC10:22
*** zzzeek has joined #openstack-placement10:25
*** cdent has joined #openstack-placement11:23
*** sean-k-mooney1 is now known as sean-k-mooney11:36
*** artom has joined #openstack-placement12:54
*** artom has quit IRC14:37
*** artom has joined #openstack-placement14:37
*** janice61 has quit IRC15:02
*** martinkennelly has quit IRC15:35
*** janice61 has joined #openstack-placement16:35
openstackgerritLance Bragstad proposed openstack/placement master: WIP add protection testing for aggregates  https://review.opendev.org/76255717:52
lbragstadcdent quick question on the approach here ^18:05
cdentoh hey hi18:05
lbragstadi was trying to figure out why https://review.opendev.org/#/c/762557/1/placement/tests/functional/gabbits/aggregate-system-admin-policy.yaml,unified@9 didn't work18:05
lbragstadand then i found this - https://opendev.org/openstack/placement/src/branch/master/placement/auth.py#L49-L5218:06
lbragstadwhich is the default auth strategy for the APIFixture18:06
lbragstadand that makes sense18:06
lbragstadi took a stab at trying to use a new fixture https://review.opendev.org/#/c/762557/1/placement/tests/functional/fixtures/gabbits.py@75818:06
lbragstadbut that's going to require keystone, unless we mock it some how18:07
lbragstadi don't see a lot of mocks anywhere in the placements test, so i'm wondering what placement folks would do to fix this18:07
cdentThe general rule of thumb was “if you think you need a mock, you probably want a unit test” or “if gabbi can’t do what you want, see if skipping the api layer will do it”18:09
cdentin this case you might want the latter18:09
cdentif I understand the existing test correctly you’re trying to make sure that “policy works”18:10
cdentnot that keystone or the http requests do the right stuff18:10
lbragstadyeah - exactly18:11
lbragstadand to do that with gabbi i need to set the request headers to simulate what keystonemiddleware would set18:11
lbragstado18:12
lbragstadi'm really testing these - https://opendev.org/openstack/placement/src/branch/master/placement/handlers/aggregate.py#L9318:12
cdentwhat _might_ work, if you really want to do this with gabbi, is to create a non-keystone auth middleware thing like noauth2 that does the header setting for you18:12
lbragstadok - i thought about that18:12
lbragstadand it could be exposed via a configuration option?18:13
lbragstador just wired up internally?18:13
cdentyou could also call get_aggregates directly with a pre-builed req object, in a functional test that sets the policies up front. one sec18:13
cdentif you grep for ‘webob.Request.blank’ in the tests that might give you some ideas18:15
cdentif you went the different auth middleware route, I’d intiially wire it up internally and see where it got you18:16
cdentthe more I look the more I think you could “cover” this with a unit test18:16
lbragstadok18:17
cdentyou can create a placement.context with whatever you like18:17
lbragstadsince the policy stuff is encapsulated in the api layer - my knee jerk reaction was to test it as a functional test, but a unit test is fine with me18:17
lbragstadso - something like this perhaps https://opendev.org/openstack/placement/src/branch/master/placement/tests/unit/test_util.py#L80-L8218:19
cdentyes, something like that. as far as I can tell all you really care about is whether `can` succeeds or fails depending on various inputs18:21
lbragstadcorrect18:21
lbragstadso long as the context object represents a realistic token18:22
cdentthat’s up to you and how you create it when putting on the req object18:24
lbragstadcool - that'll work then18:24
cdenthuzzah!18:25
lbragstadi appreciate the help - i'll work on an alternative to 76255718:25
cdentI’m glad I’m able to still be a bit useful; much of this stuff has fallen out of my brain.18:26
lbragstad:)18:28
*** amodi has quit IRC19:11
*** cdent has quit IRC19:45
*** artom has quit IRC21:15
openstackgerritLance Bragstad proposed openstack/placement master: Implement secure RBAC for aggregates  https://review.opendev.org/76023522:32
*** zzzeek has quit IRC22:34
*** zzzeek has joined #openstack-placement22:34

Generated by irclog2html.py 2.17.2 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!