)]}'
{"nova/tests/functional/notification_sample_tests/notification_sample_base.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b74efe2bbb3c69d747a8edd595cde54a603d09ce","unresolved":false,"context_lines":[{"line_number":200,"context_line":"            received,"},{"line_number":201,"context_line":"            \u0027notification %s hasn\\\u0027t been received\u0027 % event_type)"},{"line_number":202,"context_line":""},{"line_number":203,"context_line":"    def _wait_for_notifications(self, event_type, count, timeout\u003d1.0):"},{"line_number":204,"context_line":"        notifications \u003d []"},{"line_number":205,"context_line":"        while len(notifications) \u003c count:"},{"line_number":206,"context_line":"            received \u003d fake_notifier.wait_for_versioned_notification("}],"source_content_type":"text/x-python","patch_set":1,"id":"5a3905b3_954c2d9f","line":203,"range":{"start_line":203,"start_character":50,"end_line":203,"end_character":55},"updated":"2017-01-24 17:18:15.000000000","message":"nit: rename to \u0027expected_count\u0027?","commit_id":"928aa2825e0136d00853636300b2bfe37d0d5652"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"6a109c2e8d688418835ea754c978f71171ffea41","unresolved":false,"context_lines":[{"line_number":200,"context_line":"            received,"},{"line_number":201,"context_line":"            \u0027notification %s hasn\\\u0027t been received\u0027 % event_type)"},{"line_number":202,"context_line":""},{"line_number":203,"context_line":"    def _wait_for_notifications(self, event_type, count, timeout\u003d1.0):"},{"line_number":204,"context_line":"        notifications \u003d []"},{"line_number":205,"context_line":"        while len(notifications) \u003c count:"},{"line_number":206,"context_line":"            received \u003d fake_notifier.wait_for_versioned_notification("}],"source_content_type":"text/x-python","patch_set":1,"id":"5a3905b3_4d195922","line":203,"range":{"start_line":203,"start_character":50,"end_line":203,"end_character":55},"in_reply_to":"5a3905b3_954c2d9f","updated":"2017-01-24 17:25:12.000000000","message":"Done","commit_id":"928aa2825e0136d00853636300b2bfe37d0d5652"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b74efe2bbb3c69d747a8edd595cde54a603d09ce","unresolved":false,"context_lines":[{"line_number":209,"context_line":"                received,"},{"line_number":210,"context_line":"                \u0027Unexpected number of %s notifications. \u0027"},{"line_number":211,"context_line":"                \u0027Expected %d, got %d: %s\u0027 %"},{"line_number":212,"context_line":"                (event_type, count, len(event_type), notifications))"},{"line_number":213,"context_line":""},{"line_number":214,"context_line":"            notifications +\u003d self._get_notifications(event_type)"},{"line_number":215,"context_line":"            # Note(gibi): reading and then resetting the fake_notifier without"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a3905b3_d5b4f582","line":212,"range":{"start_line":212,"start_character":40,"end_line":212,"end_character":50},"updated":"2017-01-24 17:18:15.000000000","message":"Shouldn\u0027t this be the \u0027notifications\u0027 variable?","commit_id":"928aa2825e0136d00853636300b2bfe37d0d5652"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"6a109c2e8d688418835ea754c978f71171ffea41","unresolved":false,"context_lines":[{"line_number":209,"context_line":"                received,"},{"line_number":210,"context_line":"                \u0027Unexpected number of %s notifications. \u0027"},{"line_number":211,"context_line":"                \u0027Expected %d, got %d: %s\u0027 %"},{"line_number":212,"context_line":"                (event_type, count, len(event_type), notifications))"},{"line_number":213,"context_line":""},{"line_number":214,"context_line":"            notifications +\u003d self._get_notifications(event_type)"},{"line_number":215,"context_line":"            # Note(gibi): reading and then resetting the fake_notifier without"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a3905b3_add63d25","line":212,"range":{"start_line":212,"start_character":40,"end_line":212,"end_character":50},"in_reply_to":"5a3905b3_d5b4f582","updated":"2017-01-24 17:25:12.000000000","message":"Done","commit_id":"928aa2825e0136d00853636300b2bfe37d0d5652"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b74efe2bbb3c69d747a8edd595cde54a603d09ce","unresolved":false,"context_lines":[{"line_number":212,"context_line":"                (event_type, count, len(event_type), notifications))"},{"line_number":213,"context_line":""},{"line_number":214,"context_line":"            notifications +\u003d self._get_notifications(event_type)"},{"line_number":215,"context_line":"            # Note(gibi): reading and then resetting the fake_notifier without"},{"line_number":216,"context_line":"            # synchronization doesn\u0027t lead to race condition as the only"},{"line_number":217,"context_line":"            # parallelism is due to eventlet."},{"line_number":218,"context_line":"            fake_notifier.reset()"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a3905b3_b56849f6","line":215,"range":{"start_line":215,"start_character":14,"end_line":215,"end_character":18},"updated":"2017-01-24 17:18:15.000000000","message":"nit: NOTE","commit_id":"928aa2825e0136d00853636300b2bfe37d0d5652"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"6a109c2e8d688418835ea754c978f71171ffea41","unresolved":false,"context_lines":[{"line_number":212,"context_line":"                (event_type, count, len(event_type), notifications))"},{"line_number":213,"context_line":""},{"line_number":214,"context_line":"            notifications +\u003d self._get_notifications(event_type)"},{"line_number":215,"context_line":"            # Note(gibi): reading and then resetting the fake_notifier without"},{"line_number":216,"context_line":"            # synchronization doesn\u0027t lead to race condition as the only"},{"line_number":217,"context_line":"            # parallelism is due to eventlet."},{"line_number":218,"context_line":"            fake_notifier.reset()"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a3905b3_cddb894e","line":215,"range":{"start_line":215,"start_character":14,"end_line":215,"end_character":18},"in_reply_to":"5a3905b3_b56849f6","updated":"2017-01-24 17:25:12.000000000","message":"Done","commit_id":"928aa2825e0136d00853636300b2bfe37d0d5652"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"ef0f1984b7a727d64c5f17d91bfe03448be2722c","unresolved":false,"context_lines":[{"line_number":205,"context_line":"        while len(notifications) \u003c expected_count:"},{"line_number":206,"context_line":"            received \u003d fake_notifier.wait_for_versioned_notification("},{"line_number":207,"context_line":"                event_type, timeout)"},{"line_number":208,"context_line":"            self.assertTrue("},{"line_number":209,"context_line":"                received,"},{"line_number":210,"context_line":"                \u0027Unexpected number of %s notifications. \u0027"},{"line_number":211,"context_line":"                \u0027Expected %d, got %d: %s\u0027 %"},{"line_number":212,"context_line":"                (event_type, expected_count, len(notifications),"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a3905b3_7b2ec2a6","line":209,"range":{"start_line":208,"start_character":12,"end_line":209,"end_character":25},"updated":"2017-01-24 22:53:35.000000000","message":"This seems wrong. Couldn\u0027t we hit an iteration where we don\u0027t get any notifications of event_type but then on the next iteration we do? It seems the timeout isn\u0027t taking into account the while loop we have above, i.e. if we expect 7 notifications for instance.update, and we have 3 iterations where we end up with:\n\n0: 6 received\n1: 0 received\n2: 1 received (all done)\n\nWith the assertTrue here, we\u0027d fail on the 2nd iteration because received would be Falsey.","commit_id":"b8242b020f04258e21c11e2cc40e224de065cbc7"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"0b78cf621631f214b0f198f4a0f419e670cb927d","unresolved":false,"context_lines":[{"line_number":205,"context_line":"        while len(notifications) \u003c expected_count:"},{"line_number":206,"context_line":"            received \u003d fake_notifier.wait_for_versioned_notification("},{"line_number":207,"context_line":"                event_type, timeout)"},{"line_number":208,"context_line":"            self.assertTrue("},{"line_number":209,"context_line":"                received,"},{"line_number":210,"context_line":"                \u0027Unexpected number of %s notifications. \u0027"},{"line_number":211,"context_line":"                \u0027Expected %d, got %d: %s\u0027 %"},{"line_number":212,"context_line":"                (event_type, expected_count, len(notifications),"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a3905b3_b7390cdb","line":209,"range":{"start_line":208,"start_character":12,"end_line":209,"end_character":25},"in_reply_to":"5a3905b3_7b2ec2a6","updated":"2017-01-25 10:46:11.000000000","message":"Your observation is correct. However this behavior is intentional. Your example means that the test timed out waiting for the 7th notification as nothing arrived after the 6th notification within timeout amount of time.\n\nI agree that the timeout is handled non intuitively here. \nThis timeout does not mean to fail the test if not all the expected notification is received within that time. But it means that fail the test if no new notification received in that given time and not every notification is received. \n\nThis more intuitive timeout implementation needs some extra time keeping in the while loop. Let me try to implement that so we can compare.","commit_id":"b8242b020f04258e21c11e2cc40e224de065cbc7"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"251ca8baedc7b5103c73b7a725704dc831131f3e","unresolved":false,"context_lines":[{"line_number":205,"context_line":"        while len(notifications) \u003c expected_count:"},{"line_number":206,"context_line":"            received \u003d fake_notifier.wait_for_versioned_notification("},{"line_number":207,"context_line":"                event_type, timeout)"},{"line_number":208,"context_line":"            self.assertTrue("},{"line_number":209,"context_line":"                received,"},{"line_number":210,"context_line":"                \u0027Unexpected number of %s notifications. \u0027"},{"line_number":211,"context_line":"                \u0027Expected %d, got %d: %s\u0027 %"},{"line_number":212,"context_line":"                (event_type, expected_count, len(notifications),"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a461143_8c78a7fa","line":209,"range":{"start_line":208,"start_character":12,"end_line":209,"end_character":25},"in_reply_to":"5a3905b3_b7390cdb","updated":"2017-01-25 13:03:00.000000000","message":"See patch-set 3 for the more intuitive timeout behavior.","commit_id":"b8242b020f04258e21c11e2cc40e224de065cbc7"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"89f719abde79c81c6be2b745d5428d5f2cd8a0fc","unresolved":false,"context_lines":[{"line_number":202,"context_line":""},{"line_number":203,"context_line":"    def _wait_for_notifications(self, event_type, expected_count, timeout\u003d1.0):"},{"line_number":204,"context_line":"        notifications \u003d []"},{"line_number":205,"context_line":"        start_time \u003d time.clock()"},{"line_number":206,"context_line":""},{"line_number":207,"context_line":"        while (len(notifications) \u003c expected_count"},{"line_number":208,"context_line":"               and time.clock() - start_time \u003c timeout):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_f6bc1008","line":205,"range":{"start_line":205,"start_character":26,"end_line":205,"end_character":31},"updated":"2017-01-28 00:56:03.000000000","message":"I usually see time.time() used for timeout tracking like this. I\u0027m not sure if it would actually matter in this case though.","commit_id":"189a4a7c76d224a227c09f2b34b56ef91c1680c1"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"239bb061a4019a81a8d9ee8dca7e0c79423a335b","unresolved":false,"context_lines":[{"line_number":202,"context_line":""},{"line_number":203,"context_line":"    def _wait_for_notifications(self, event_type, expected_count, timeout\u003d1.0):"},{"line_number":204,"context_line":"        notifications \u003d []"},{"line_number":205,"context_line":"        start_time \u003d time.clock()"},{"line_number":206,"context_line":""},{"line_number":207,"context_line":"        while (len(notifications) \u003c expected_count"},{"line_number":208,"context_line":"               and time.clock() - start_time \u003c timeout):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_ba3fb485","line":205,"range":{"start_line":205,"start_character":26,"end_line":205,"end_character":31},"in_reply_to":"3a461143_f6bc1008","updated":"2017-01-30 08:51:17.000000000","message":"I think the difference between time.time and time.clock does not really matter here but If I have to respin the patch I will change it to time.time() just for consistency with other places.","commit_id":"189a4a7c76d224a227c09f2b34b56ef91c1680c1"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"7a5a9ba5a3dc816d5de8654496febcacafd112d2","unresolved":false,"context_lines":[{"line_number":207,"context_line":"        while (len(notifications) \u003c expected_count"},{"line_number":208,"context_line":"               and time.clock() - start_time \u003c timeout):"},{"line_number":209,"context_line":""},{"line_number":210,"context_line":"            fake_notifier.wait_for_versioned_notification(event_type, timeout)"},{"line_number":211,"context_line":"            notifications +\u003d self._get_notifications(event_type)"},{"line_number":212,"context_line":"            # NOTE(gibi): reading and then resetting the fake_notifier without"},{"line_number":213,"context_line":"            # synchronization doesn\u0027t lead to race condition as the only"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_d6dab4e7","line":210,"updated":"2017-01-28 01:22:09.000000000","message":"This implies that the notifications are sent asynchronously during tests and we can wait for them to arrive. Is there no way we could set up notifications to be synchronous for testing? I\u0027m not too familiar with oslo.messaging\u0027s notification stuff, but I saw there\u0027s a notification_driver called \u0027test\u0027 [1]. Do we use that already? I couldn\u0027t find what notification_driver is used in tests.\n\n[1] https://github.com/openstack/oslo.messaging/blob/master/oslo_messaging/notify/_impl_test.py","commit_id":"189a4a7c76d224a227c09f2b34b56ef91c1680c1"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"239bb061a4019a81a8d9ee8dca7e0c79423a335b","unresolved":false,"context_lines":[{"line_number":207,"context_line":"        while (len(notifications) \u003c expected_count"},{"line_number":208,"context_line":"               and time.clock() - start_time \u003c timeout):"},{"line_number":209,"context_line":""},{"line_number":210,"context_line":"            fake_notifier.wait_for_versioned_notification(event_type, timeout)"},{"line_number":211,"context_line":"            notifications +\u003d self._get_notifications(event_type)"},{"line_number":212,"context_line":"            # NOTE(gibi): reading and then resetting the fake_notifier without"},{"line_number":213,"context_line":"            # synchronization doesn\u0027t lead to race condition as the only"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_9f6aeaec","line":210,"in_reply_to":"3a461143_d6dab4e7","updated":"2017-01-30 08:51:17.000000000","message":"Some of the notifications emitted after the REST request triggered the notification is answered. Also some notification is emitted after all the REST visible changes happened. Good example for this is the current bug. The test boots up an instance and waits for the status of the  instance to become ACTIVE. However the instance reaches the ACTIVE status before the last instance.update is emitted so the test has nothing to really wait for except the notification itself.\n\nI\u0027m aware of the _impl_test notifier. Nova has a very similar (but hand rolled, and slightly enhanced) fake notifier [1] used in these tests. \n\nI\u0027m happy to further enhance the notification test env. However I need help. Could you give a bit more specific hints how could I make the whole \"boot and instance and assert that every instance.update notifications are emitted\" in a fully synchronous way?\n\n[1] https://github.com/openstack/nova/blob/master/nova/tests/unit/fake_notifier.py","commit_id":"189a4a7c76d224a227c09f2b34b56ef91c1680c1"}]}
