Thursday, 2023-06-29

*** ralonsoh_ is now known as ralonsoh07:11
opendevreviewAmit Uniyal proposed openstack/os-vif stable/yoga: set default qos policy  https://review.opendev.org/c/openstack/os-vif/+/88671007:12
Uggla_bauzas, did you had a chance to look at my serie again ?07:26
opendevreviewAmit Uniyal proposed openstack/os-vif stable/yoga: set default qos policy  https://review.opendev.org/c/openstack/os-vif/+/88671007:57
opendevreviewKashyap Chamarthy proposed openstack/nova master: Bump MIN_{LIBVIRT,QEMU} for "Bobcat"  https://review.opendev.org/c/openstack/nova/+/88725508:22
kashyapCc: sean-k-mooney --^   (No rush :))08:23
kashyap(Maybe I can remove still one more constant.  Me looks)08:27
opendevreviewAmit Uniyal proposed openstack/os-vif stable/xena: set default qos policy  https://review.opendev.org/c/openstack/os-vif/+/88671609:43
opendevreviewYamato Tanaka proposed openstack/python-novaclient master: Do exact-matching when finding one instance by name  https://review.opendev.org/c/openstack/python-novaclient/+/88726811:50
dvo-plvHello, All. I'm currently writing functional test, my result should be expected fail. How should I handle this properly?13:49
dvo-plvShould I set just @unittest.expectedFailure, or I need to create some additional note?13:56
*** blarnath is now known as d34dh0r5314:13
melwittdvo-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 under15:32
melwitt nova/tests/functional/regressions/15:32
dvo-plvNo, this is not a bug. This is a test for new feature15:34
dvo-plvtest is based on this Sean's comment https://review.opendev.org/c/openstack/nova/+/876075/14/nova/scheduler/request_filter.py#28515:34
dvo-plvI need to catch configuration conflict between image and flavor, during the resize and rebuils15:34
melwittdvo-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 situation15:36
melwittin 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#L3615:38
dvo-plvokay, i see thank you16:42
opendevreviewAlexey Stupnikov proposed openstack/nova master: Add functional tests to reproduce bug #1994983  https://review.opendev.org/c/openstack/nova/+/86341616:46
*** iurygregory_ is now known as iurygregory16:58
dvo-plvmelwitt, Maybe you can ghelp me how to handle this output17:54
dvo-plv(Pdb) n17:54
dvo-plvAssertionError: Notification instance.resize.end hasn't been received. Received:17:54
dvo-plv[]17:54
dvo-plvIt does not catch with asserraises17: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
melwittdvo-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 curious17:57
dvo-plvI alredy tried this way18: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) ex18:00
dvo-plv*** NameError: name 'ex' is not defined18:00
dvo-plvit does not generate output for handing18:00
dvo-plvI expected this output18:01
dvo-plv  File "/opt/stack/nova/nova/virt/hardware.py", line 1971, in get_packed_virtqueue_constraint18:01
dvo-plv    raise exception.FlavorImageConflict(18:01
dvo-plvnova.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
melwittcan you link your code or pastebin it? it sounds like you might be missing a notifications fixture/mock18:03
dvo-plvit calls this method https://review.opendev.org/c/openstack/nova/+/876075/14/nova/virt/hardware.py18:04
dvo-plvvia this https://review.opendev.org/c/openstack/nova/+/876075/14/nova/scheduler/request_filter.py18:04
melwittI mean the code of your func test. it's hard to tell what's wrong without seeing it18: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 resize18:06
dvo-plv        due to image property and flavor extra spec conflict18: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 property18: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 property18: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
melwittplease 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 spec18:07
dvo-plv        new_flavor_id = self._create_flavor(extra_spec={'hw:virtio_packed_ring': 'false'})18:07
dvo-plv        import rpdb18: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-plvhttps://paste.opendev.org/show/bD8BWCnpsUY8Rr7c6Hc7/18:09
dvo-plvI implemented this test here18: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_conflict18:10
* melwitt looks18:11
melwittoh, right sorry 😣 bc this is a func test you will rather have to look at the returned http status code and message. sec18:13
dvo-plvI saw this option in the other examples 18:14
dvo-plv        self.assertEqual(403, ex.response.status_code)18:14
dvo-plvbut i can not get status code18:14
dvo-plvhttps://paste.opendev.org/show/bOdkEFYHa3h24nBD5Ws1/18:17
dvo-plvthis is test output18:17
melwittyeah, 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 case18:17
melwittsince you're testing for an error condition18:17
melwittso 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#L34718:19
dvo-plvI see, I will try to figure out without this wrapper, thank you18:19
melwittin 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-plvokay, I believe it will help me, thank you18:25
dvo-plvmaybe I need something else for my case ?18:54
dvo-plvI updated my test in this way 18:54
dvo-plvhttps://paste.opendev.org/show/bXTsHeFs7ct1qOUcLg1r/18:54
dvo-plvBut 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-plvIt does not call class Fault(webob.exc.HTTPException) fault names19:00
melwittdvo-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 API19:02
melwitt*you may have a bug19:02
dvo-plvyes, look like it does not call status code from this class             409: "conflictingRequest",19:02
dvo-plvclass Fault(webob.exc.HTTPException):19:02
melwittyeah 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 up19: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/!