*** ralonsoh_ is now known as ralonsoh | 07:11 | |
opendevreview | Amit Uniyal proposed openstack/os-vif stable/yoga: set default qos policy https://review.opendev.org/c/openstack/os-vif/+/886710 | 07:12 |
---|---|---|
Uggla_ | bauzas, did you had a chance to look at my serie again ? | 07:26 |
opendevreview | Amit Uniyal proposed openstack/os-vif stable/yoga: set default qos policy https://review.opendev.org/c/openstack/os-vif/+/886710 | 07:57 |
opendevreview | Kashyap Chamarthy proposed openstack/nova master: Bump MIN_{LIBVIRT,QEMU} for "Bobcat" https://review.opendev.org/c/openstack/nova/+/887255 | 08:22 |
kashyap | Cc: sean-k-mooney --^ (No rush :)) | 08:23 |
kashyap | (Maybe I can remove still one more constant. Me looks) | 08:27 |
opendevreview | Amit Uniyal proposed openstack/os-vif stable/xena: set default qos policy https://review.opendev.org/c/openstack/os-vif/+/886716 | 09:43 |
opendevreview | Yamato Tanaka proposed openstack/python-novaclient master: Do exact-matching when finding one instance by name https://review.opendev.org/c/openstack/python-novaclient/+/887268 | 11:50 |
dvo-plv | Hello, All. I'm currently writing functional test, my result should be expected fail. How should I handle this properly? | 13:49 |
dvo-plv | Should I set just @unittest.expectedFailure, or I need to create some additional note? | 13:56 |
*** blarnath is now known as d34dh0r53 | 14:13 | |
melwitt | dvo-plv: are you doing the func test as part of a bug fix? if so what we usually do is put the func test first and assert the wrong behavior with a code comment explaining what bug it's about, then stack the fix patch on top and as part of it change the assert in the func test to assert the correct behavior and remove the code comment about the buggy behavior. and if the func test is for a regression, it should go under | 15:32 |
melwitt | nova/tests/functional/regressions/ | 15:32 |
dvo-plv | No, this is not a bug. This is a test for new feature | 15:34 |
dvo-plv | test is based on this Sean's comment https://review.opendev.org/c/openstack/nova/+/876075/14/nova/scheduler/request_filter.py#285 | 15:34 |
dvo-plv | I need to catch configuration conflict between image and flavor, during the resize and rebuils | 15:34 |
melwitt | dvo-plv: ok I see. for that you can do like self.assertRaises(exception, func, arg, arg, arg, ...) if you want to assert that the proper exception is raised in a particular situation | 15:36 |
melwitt | in the test. expectedFailure is more for a test that we have to disable because something is wrong and remove the decorator whenever the problem is fixed. there's only a couple of examples in the code like https://github.com/openstack/nova/blob/d56d1a828df512136645aa257082bc929a4e353d/nova/tests/functional/libvirt/test_shared_resource_provider.py#L36 | 15:38 |
dvo-plv | okay, i see thank you | 16:42 |
opendevreview | Alexey Stupnikov proposed openstack/nova master: Add functional tests to reproduce bug #1994983 https://review.opendev.org/c/openstack/nova/+/863416 | 16:46 |
*** iurygregory_ is now known as iurygregory | 16:58 | |
dvo-plv | melwitt, Maybe you can ghelp me how to handle this output | 17:54 |
dvo-plv | (Pdb) n | 17:54 |
dvo-plv | AssertionError: Notification instance.resize.end hasn't been received. Received: | 17:54 |
dvo-plv | [] | 17:54 |
dvo-plv | It does not catch with asserraises | 17:54 |
dvo-plv | (Pdb) x = self.assertRaises(exception.FlavorImageConflict,self._resize_server(server, new_flavor_id)) | 17:54 |
dvo-plv | *** AssertionError: Notification instance.resize.end hasn't been received. Received: | 17:54 |
dvo-plv | [] | 17:54 |
melwitt | dvo-plv: it should be self.assertRaises(exception.FlavorImageConflict, self._resize_server, server, new_flavor_id) https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertRaises in case you're curious | 17:57 |
dvo-plv | I alredy tried this way | 18:00 |
dvo-plv | (Pdb) ex = self.assertRaises(exception.FlavorImageConflict,self._resize_server,server,new_flavor_id) | 18:00 |
dvo-plv | *** AssertionError: Notification instance.resize.end hasn't been received. Received: | 18:00 |
dvo-plv | [] | 18:00 |
dvo-plv | (Pdb) ex | 18:00 |
dvo-plv | *** NameError: name 'ex' is not defined | 18:00 |
dvo-plv | it does not generate output for handing | 18:00 |
dvo-plv | I expected this output | 18:01 |
dvo-plv | File "/opt/stack/nova/nova/virt/hardware.py", line 1971, in get_packed_virtqueue_constraint | 18:01 |
dvo-plv | raise exception.FlavorImageConflict( | 18:01 |
dvo-plv | nova.exception.FlavorImageConflict: Flavor vhrvsprsjopvuncogcmp has hw:virtio_packed_ring extra spec explicitly set to False, conflicting with image fake-image-custom-property which has hw_virtio_packed_ring explicitly set to True. | 18:01 |
melwitt | can you link your code or pastebin it? it sounds like you might be missing a notifications fixture/mock | 18:03 |
dvo-plv | it calls this method https://review.opendev.org/c/openstack/nova/+/876075/14/nova/virt/hardware.py | 18:04 |
dvo-plv | via this https://review.opendev.org/c/openstack/nova/+/876075/14/nova/scheduler/request_filter.py | 18:04 |
melwitt | I mean the code of your func test. it's hard to tell what's wrong without seeing it | 18:06 |
dvo-plv | def test_resize_virtio_packed_ring_image_flavor_conflict(self): | 18:06 |
dvo-plv | """Ensure that packed_virtqueue_filter filter will reject resize | 18:06 |
dvo-plv | due to image property and flavor extra spec conflict | 18:06 |
dvo-plv | """ | 18:06 |
dvo-plv | # Decorate compute 1 and compute2 resource provider with trait. | 18:06 |
dvo-plv | rp_uuid1 = self._get_provider_uuid_by_host(self.compute1.host) | 18:06 |
dvo-plv | rp_uuid2 = self._get_provider_uuid_by_host(self.compute2.host) | 18:06 |
dvo-plv | self._set_provider_traits(rp_uuid1, ['COMPUTE_NET_VIRTIO_PACKED']) | 18:06 |
dvo-plv | self._set_provider_traits(rp_uuid2, ['COMPUTE_NET_VIRTIO_PACKED']) | 18:06 |
dvo-plv | # Create image with enabled Virtio Packed Ring property | 18:06 |
dvo-plv | image = self._create_image(metadata={'hw_virtio_packed_ring': 'true'}) | 18:07 |
dvo-plv | flavor_id = self._create_flavor(extra_spec={}) | 18:07 |
dvo-plv | # Create server using only image with property | 18:07 |
dvo-plv | server = self._create_server(flavor_id=flavor_id, | 18:07 |
dvo-plv | image_uuid=image['id'], | 18:07 |
dvo-plv | expected_state='ACTIVE', | 18:07 |
dvo-plv | networks='none') | 18:07 |
melwitt | please use pastebin for pastes 😆 | 18:07 |
dvo-plv | server = self._wait_for_state_change(server, 'ACTIVE') | 18:07 |
dvo-plv | # Create flavor with disabled Virtio Packed Ring in the extra spec | 18:07 |
dvo-plv | new_flavor_id = self._create_flavor(extra_spec={'hw:virtio_packed_ring': 'false'}) | 18:07 |
dvo-plv | import rpdb | 18:07 |
dvo-plv | debugger = rpdb.Rpdb(port=12345) | 18:07 |
dvo-plv | debugger.set_trace() | 18:07 |
dvo-plv | ex = self.assertRaises(exception.FlavorImageConflict, self._resize_server, server, new_flavor_id) | 18:07 |
dvo-plv | https://paste.opendev.org/show/bD8BWCnpsUY8Rr7c6Hc7/ | 18:09 |
dvo-plv | I implemented this test here | 18:10 |
dvo-plv | (functional) stack@server72:/opt/stack/nova$ tox -e functional -- nova.tests.functional.test_servers.TraitsBasedSchedulingTest.test_resize_virtio_packed_ring_image_flavor_conflict | 18:10 |
* melwitt looks | 18:11 | |
melwitt | oh, right sorry 😣 bc this is a func test you will rather have to look at the returned http status code and message. sec | 18:13 |
dvo-plv | I saw this option in the other examples | 18:14 |
dvo-plv | self.assertEqual(403, ex.response.status_code) | 18:14 |
dvo-plv | but i can not get status code | 18:14 |
dvo-plv | https://paste.opendev.org/show/bOdkEFYHa3h24nBD5Ws1/ | 18:17 |
dvo-plv | this is test output | 18:17 |
melwitt | yeah, I think you can't use the _resize_server helper function in this case bc it will only return you the server object and bc it will wait for expected notifications https://github.com/openstack/nova/blob/master/nova/tests/functional/integrated_helpers.py#L530 which are not all going to happen in your case | 18:17 |
melwitt | since you're testing for an error condition | 18:17 |
melwitt | so you'll want to unwrap that i.e. call self.api.post_server_action directly, like this https://github.com/openstack/nova/blob/master/nova/tests/functional/test_servers.py#L347 | 18:19 |
dvo-plv | I see, I will try to figure out without this wrapper, thank you | 18:19 |
melwitt | in the func tests the error exception will always be client.OpenStackApiException with the details encapsulated inside of it as it's imitating a rest API caller who will receive only an error from the client, not the internal exception that nova raised | 18:22 |
dvo-plv | okay, I believe it will help me, thank you | 18:25 |
dvo-plv | maybe I need something else for my case ? | 18:54 |
dvo-plv | I updated my test in this way | 18:54 |
dvo-plv | https://paste.opendev.org/show/bXTsHeFs7ct1qOUcLg1r/ | 18:54 |
dvo-plv | But i get this error testtools.matchers._impl.MismatchError: <bound method TestOpenStackClient.post_server_action of <nova.tests.functional.api.client.TestOpenStackClient object at 0x7f7b4fe13b50>> returned {} | 18:55 |
dvo-plv | (Pdb) self.api.post_server_action(server['id'], {'resize': {'flavorRef': new_flavor_id}}) | 18:55 |
dvo-plv | {} | 18:55 |
dvo-plv | It does not call class Fault(webob.exc.HTTPException) fault names | 19:00 |
melwitt | dvo-plv: that means that when you requested the resize you got a http status OK and you were expecting probably a 409 or? if your code is supposed to raise a conflict/409 to the rest API caller, there may be a bug with the exception not propagating up to the API | 19:02 |
melwitt | *you may have a bug | 19:02 |
dvo-plv | yes, look like it does not call status code from this class 409: "conflictingRequest", | 19:02 |
dvo-plv | class Fault(webob.exc.HTTPException): | 19:02 |
melwitt | yeah so you'll want to debug and trace from where you raise exception.FlavorImageConflict up to the API and find where it's not being propagated up | 19:04 |
melwitt | (again, if your intended behavior is a http 409 returned to the rest API caller) | 19:05 |
Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!