)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"f29970e26b0768b2acbc465e8a7830df5a814ba6","unresolved":false,"context_lines":[{"line_number":15,"context_line":"subnet_id to the delete_csnat_router_interface_ports."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"Change-Id: I16735195c6575454876acd0e99ef45f382963566"},{"line_number":18,"context_line":"Related-Bug: #1443524"},{"line_number":19,"context_line":"Co-Authored-By: Swaminathan Vasudevan \u003cswaminathan.vasudevan@hp.com\u003e"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":21,"id":"1a4dcd0f_91dcde47","line":18,"updated":"2015-08-10 08:20:35.000000000","message":"Should this be Closes? Also bug 1443596 should probably be duplicated on this one","commit_id":"a9ed86ca8f6f3a64b19decb2454fcc062df9163c"}],"neutron/db/l3_dvr_db.py":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"e920b3fd5ea81c587d9101b1630c84dcb12728a8","unresolved":false,"context_lines":[{"line_number":344,"context_line":"        else:"},{"line_number":345,"context_line":"            port, subnets \u003d self._remove_interface_by_subnet("},{"line_number":346,"context_line":"                    context, router_id, subnet_id, device_owner)"},{"line_number":347,"context_line":"        self._validate_dvr_router_interface_remove_and_notify_agent("},{"line_number":348,"context_line":"            context, router, subnets[0][\u0027id\u0027])"},{"line_number":349,"context_line":"        router_interface_info \u003d self._make_router_interface_info("},{"line_number":350,"context_line":"            router_id, port[\u0027tenant_id\u0027], port[\u0027id\u0027], subnets[0][\u0027id\u0027],"}],"source_content_type":"text/x-python","patch_set":4,"id":"5ad0253b_23cca834","line":347,"updated":"2015-04-28 21:50:09.000000000","message":"I suggested to cut the method at line 347 (332 of the base patchset #2) so that the upper half is about extracting data from the request and validating the input, and the lower half is about performing the action. \n\nThis three-way split makes no sense IMO, and it does make the test look worse.","commit_id":"9c4ee80fdf789259bc57ff7fc452f5146fc643f2"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"2f6d1ea05a5316673e9240f8f5fb0da61f8e6a44","unresolved":false,"context_lines":[{"line_number":344,"context_line":"        else:"},{"line_number":345,"context_line":"            port, subnets \u003d self._remove_interface_by_subnet("},{"line_number":346,"context_line":"                    context, router_id, subnet_id, device_owner)"},{"line_number":347,"context_line":"        self._validate_dvr_router_interface_remove_and_notify_agent("},{"line_number":348,"context_line":"            context, router, subnets[0][\u0027id\u0027])"},{"line_number":349,"context_line":"        router_interface_info \u003d self._make_router_interface_info("},{"line_number":350,"context_line":"            router_id, port[\u0027tenant_id\u0027], port[\u0027id\u0027], subnets[0][\u0027id\u0027],"}],"source_content_type":"text/x-python","patch_set":4,"id":"5ad0253b_b7ceb281","line":347,"in_reply_to":"5ad0253b_23cca834","updated":"2015-04-29 00:16:42.000000000","message":"The reason I need to split it up in this way was that I don\u0027t need to pass the \"port\" and \"subnets\" to the the validate function un-necessarily.\nIn this case I am directly passing the \"subnet-id\" of the port for the validation and I am done with it.","commit_id":"9c4ee80fdf789259bc57ff7fc452f5146fc643f2"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"207fd064d902e49d9b413bb72ca2bd1e23b91930","unresolved":false,"context_lines":[{"line_number":344,"context_line":"        else:"},{"line_number":345,"context_line":"            port, subnets \u003d self._remove_interface_by_subnet("},{"line_number":346,"context_line":"                    context, router_id, subnet_id, device_owner)"},{"line_number":347,"context_line":"        self._validate_dvr_router_interface_remove_and_notify_agent("},{"line_number":348,"context_line":"            context, router, subnets[0][\u0027id\u0027])"},{"line_number":349,"context_line":"        router_interface_info \u003d self._make_router_interface_info("},{"line_number":350,"context_line":"            router_id, port[\u0027tenant_id\u0027], port[\u0027id\u0027], subnets[0][\u0027id\u0027],"}],"source_content_type":"text/x-python","patch_set":4,"id":"5ad0253b_f2a43809","line":347,"in_reply_to":"5ad0253b_b7ceb281","updated":"2015-04-29 01:02:27.000000000","message":"Based on your feedback I have pushed in another patch.","commit_id":"9c4ee80fdf789259bc57ff7fc452f5146fc643f2"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"5466d6de3b4dd3a4b2637b6e070b206c59cca289","unresolved":false,"context_lines":[{"line_number":312,"context_line":"    def _validate_dvr_router_interface_remove_and_notify_agent("},{"line_number":313,"context_line":"        self, context, router, port, subnets):"},{"line_number":314,"context_line":"        if router.extra_attributes.distributed:"},{"line_number":315,"context_line":"            if router.gw_port and subnets[0][\u0027id\u0027]:"},{"line_number":316,"context_line":"                self.delete_csnat_router_interface_ports("},{"line_number":317,"context_line":"                    context.elevated(), router, subnet_id\u003dsubnets[0][\u0027id\u0027])"},{"line_number":318,"context_line":"            plugin \u003d manager.NeutronManager.get_service_plugins().get("}],"source_content_type":"text/x-python","patch_set":5,"id":"5ad0253b_0d93055d","line":315,"updated":"2015-04-29 11:26:27.000000000","message":"Here\u0027s an idea - What if you provide two versions of delete_csnat_router_interface_ports, one that does not accept subnet_id and deletes all SNAT ports, and one in the singular form that accepts subnet_id as a mandatory parameter and deletes only the SNAT ports on that subnet? (The methods could share code internally). The unit tests should be simpler after this...","commit_id":"08c41c3e6cc842ec5818d58116eedce553f1ccfb"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"e8e268802aba46097ce2d009a28bd80f76cb4533","unresolved":false,"context_lines":[{"line_number":312,"context_line":"    def _validate_dvr_router_interface_remove_and_notify_agent("},{"line_number":313,"context_line":"        self, context, router, port, subnets):"},{"line_number":314,"context_line":"        if router.extra_attributes.distributed:"},{"line_number":315,"context_line":"            if router.gw_port and subnets[0][\u0027id\u0027]:"},{"line_number":316,"context_line":"                self.delete_csnat_router_interface_ports("},{"line_number":317,"context_line":"                    context.elevated(), router, subnet_id\u003dsubnets[0][\u0027id\u0027])"},{"line_number":318,"context_line":"            plugin \u003d manager.NeutronManager.get_service_plugins().get("}],"source_content_type":"text/x-python","patch_set":5,"id":"3acd31a7_1b60fc34","line":315,"in_reply_to":"5ad0253b_0d93055d","updated":"2015-04-29 16:33:56.000000000","message":"I don\u0027t see how that would help this unit test in particular.","commit_id":"08c41c3e6cc842ec5818d58116eedce553f1ccfb"},{"author":{"_account_id":13770,"name":"Adolfo Duarte","email":"adduarte@redhat.com","username":"adolfoduarte"},"change_message_id":"d703aeea6ed70c61029daa57cfee5061be5a017c","unresolved":false,"context_lines":[{"line_number":310,"context_line":"            context, router_interface_info, \u0027add\u0027)"},{"line_number":311,"context_line":"        return router_interface_info"},{"line_number":312,"context_line":""},{"line_number":313,"context_line":"    def _validate_dvr_router_interface_remove_and_notify_agent("},{"line_number":314,"context_line":"        self, context, router, port, subnets):"},{"line_number":315,"context_line":"        if router.extra_attributes.distributed:"},{"line_number":316,"context_line":"            if router.gw_port and subnets[0][\u0027id\u0027]:"}],"source_content_type":"text/x-python","patch_set":9,"id":"7a016987_580d113d","line":313,"updated":"2015-05-28 16:27:23.000000000","message":"The name of this method is not very clear. Use doc strings to give a hint as to what it does: \n\u0027\u0027\u0027 method validates router has gw port and subnets have ids before removing the csnat router interface....\u0027\u0027\u0027","commit_id":"8dbe95c3004f1607cbd1b10c34ca4592ec24cf44"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"fb92b5a6097ab54462e30df480f76229951fda5d","unresolved":false,"context_lines":[{"line_number":310,"context_line":"            context, router_interface_info, \u0027add\u0027)"},{"line_number":311,"context_line":"        return router_interface_info"},{"line_number":312,"context_line":""},{"line_number":313,"context_line":"    def _validate_dvr_router_interface_remove_and_notify_agent("},{"line_number":314,"context_line":"        self, context, router, port, subnets):"},{"line_number":315,"context_line":"        if router.extra_attributes.distributed:"},{"line_number":316,"context_line":"            if router.gw_port and subnets[0][\u0027id\u0027]:"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa32b979_4597eaeb","line":313,"in_reply_to":"7a016987_580d113d","updated":"2015-06-17 19:02:55.000000000","message":"Done","commit_id":"8dbe95c3004f1607cbd1b10c34ca4592ec24cf44"}],"neutron/tests/functional/services/l3_router/test_l3_router_plugin.py":[{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"4bed3bbcb66f263a9f010611aea403229aca918f","unresolved":false,"context_lines":[{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    def test_remove_router_interface_by_port_leaves_snat_intact(self):"},{"line_number":129,"context_line":"        self._test_remove_router_interface_leaves_snat_intact("},{"line_number":130,"context_line":"            by_subnet\u003dFalse)"}],"source_content_type":"text/x-python","patch_set":8,"id":"3acd31a7_45053878","line":130,"updated":"2015-05-01 00:27:13.000000000","message":"With the change that you have made in the test code, you have removed the original UT mocked version from the test_l3_dvr_db.py\nCould you please add it back along with your tests.","commit_id":"a49d10ec655213205fb2882df13760e7dca291c3"}],"neutron/tests/unit/db/test_l3_dvr_db.py":[{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"b3d861fb83b8777617587a83590987723306813d","unresolved":false,"context_lines":[{"line_number":477,"context_line":"        self.assertFalse(create_fip.called)"},{"line_number":478,"context_line":"        self.assertFalse(delete_fip.called)"},{"line_number":479,"context_line":""},{"line_number":480,"context_line":"    def test_remove_router_int_by_port_deletes_csnat_with_valid_subnet(self):"},{"line_number":481,"context_line":"        interface_info \u003d {\u0027port_id\u0027: \u0027123\u0027}"},{"line_number":482,"context_line":"        port \u003d {"},{"line_number":483,"context_line":"            \u0027id\u0027: \u0027123\u0027,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7ad32947_b8c46392","line":480,"updated":"2015-04-27 21:42:09.000000000","message":"Having to add such a large test for a simple one-line change is an anti-pattern.  Please isolate the functionality under test so the test effort required isn\u0027t so extreme.  Feel to find me in-channel if you need help.","commit_id":"0ef6991f2e3824049ed0f751c229388d9bc5593d"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"d58ca82c4e0f194c760a78c1e9582059c4a38776","unresolved":false,"context_lines":[{"line_number":477,"context_line":"        self.assertFalse(create_fip.called)"},{"line_number":478,"context_line":"        self.assertFalse(delete_fip.called)"},{"line_number":479,"context_line":""},{"line_number":480,"context_line":"    def test_remove_router_int_by_port_deletes_csnat_with_valid_subnet(self):"},{"line_number":481,"context_line":"        interface_info \u003d {\u0027port_id\u0027: \u0027123\u0027}"},{"line_number":482,"context_line":"        port \u003d {"},{"line_number":483,"context_line":"            \u0027id\u0027: \u0027123\u0027,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7ad32947_5e73f74d","line":480,"in_reply_to":"7ad32947_335e34ea","updated":"2015-04-27 23:32:21.000000000","message":"perhaps if we split method:\n\nremove_router_interface\n\nat line 332 so that we have one half that does the validation and extract parameters and the other that does get on the removal, then we\u0027ll have much fewer stuff to mock up.\n\nBottom line is that you\u0027d want  delete_csnat_router_interface_ports to get a non-none subnet when called by remove_router_interface.","commit_id":"0ef6991f2e3824049ed0f751c229388d9bc5593d"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"d57c5597fe4c8108bbbdc8c6229225e7958067b0","unresolved":false,"context_lines":[{"line_number":477,"context_line":"        self.assertFalse(create_fip.called)"},{"line_number":478,"context_line":"        self.assertFalse(delete_fip.called)"},{"line_number":479,"context_line":""},{"line_number":480,"context_line":"    def test_remove_router_int_by_port_deletes_csnat_with_valid_subnet(self):"},{"line_number":481,"context_line":"        interface_info \u003d {\u0027port_id\u0027: \u0027123\u0027}"},{"line_number":482,"context_line":"        port \u003d {"},{"line_number":483,"context_line":"            \u0027id\u0027: \u0027123\u0027,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7ad32947_335e34ea","line":480,"in_reply_to":"7ad32947_b8c46392","updated":"2015-04-27 22:28:55.000000000","message":"Maru thanks for your input, please let me know what would be better to do , as I am out of ideas on this test case.","commit_id":"0ef6991f2e3824049ed0f751c229388d9bc5593d"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"e920b3fd5ea81c587d9101b1630c84dcb12728a8","unresolved":false,"context_lines":[{"line_number":520,"context_line":"        router.extra_attributes.distributed \u003d True"},{"line_number":521,"context_line":"        remove_by_port \u003d True"},{"line_number":522,"context_line":"        remove_by_subnet \u003d False"},{"line_number":523,"context_line":"        with contextlib.nested("},{"line_number":524,"context_line":"            mock.patch.object(self.mixin,"},{"line_number":525,"context_line":"                              \u0027_validate_interface_info\u0027),"},{"line_number":526,"context_line":"            mock.patch.object(self.mixin,"}],"source_content_type":"text/x-python","patch_set":4,"id":"5ad0253b_83201cf9","line":523,"updated":"2015-04-28 21:50:09.000000000","message":"The point of breaking the functionality up was that you don\u0027t have to mock up under the hood, but you can mock directly _validate_dvr_router_interface_remove_and_notify_agent instead!","commit_id":"9c4ee80fdf789259bc57ff7fc452f5146fc643f2"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"5466d6de3b4dd3a4b2637b6e070b206c59cca289","unresolved":false,"context_lines":[{"line_number":476,"context_line":"                fip, floatingip, router))"},{"line_number":477,"context_line":"        self.assertFalse(create_fip.called)"},{"line_number":478,"context_line":"        self.assertFalse(delete_fip.called)"},{"line_number":479,"context_line":""},{"line_number":480,"context_line":"    def test__validate_dvr_router_interface_remove_and_notify_agent(self):"},{"line_number":481,"context_line":"        subnet \u003d {\u0027id\u0027: \u00271234\u0027}"},{"line_number":482,"context_line":"        port \u003d {"}],"source_content_type":"text/x-python","patch_set":5,"id":"5ad0253b_c27efcad","line":479,"updated":"2015-04-29 11:26:27.000000000","message":"This amount of mocks is a signal that you\u0027re either testing at a higher level than necessary, or you should be testing at this level but without mocks (Psuedo integration test), or both. See http://fabiopereira.me/blog/2010/05/27/ttdd-tautological-test-driven-development-anti-pattern.\n\nThese tests are:\n\n* Hard to follow\n* Hard to maintain - Required to be changed with every refactor (And then the new test will be changed until it passes, completely missing the point of regression tests)\n* Hard to write - Isn\u0027t it easier to just execute code from Neutron and assert output?\n* Don\u0027t test Neutron, but test some made up, synthetic scenario\n\nI know that other tests in this file are written in the same manner, but it\u0027s actually very easy to break from that, start a new test class, and start writing more effective tests, starting from this one.\n\nLooking at the code, it\u0027s not clear to me how to divide the functions further and test at a lower level. It is very clear to me though, how you would test this without mocks. First, don\u0027t mock anything :) Second, setup a class with the Ml2 plugin and the L3 service plugin. Create two networks (And subnets), a DVR router, attach it to the two networks. Remove one of its interfaces (By port). Assert that it still has the other SNAT interface.","commit_id":"08c41c3e6cc842ec5818d58116eedce553f1ccfb"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"e8e268802aba46097ce2d009a28bd80f76cb4533","unresolved":false,"context_lines":[{"line_number":476,"context_line":"                fip, floatingip, router))"},{"line_number":477,"context_line":"        self.assertFalse(create_fip.called)"},{"line_number":478,"context_line":"        self.assertFalse(delete_fip.called)"},{"line_number":479,"context_line":""},{"line_number":480,"context_line":"    def test__validate_dvr_router_interface_remove_and_notify_agent(self):"},{"line_number":481,"context_line":"        subnet \u003d {\u0027id\u0027: \u00271234\u0027}"},{"line_number":482,"context_line":"        port \u003d {"}],"source_content_type":"text/x-python","patch_set":5,"id":"3acd31a7_1effca02","line":479,"in_reply_to":"5ad0253b_c27efcad","updated":"2015-04-29 16:33:56.000000000","message":"Thanks for your detailed comment on this test case.\nThe current unit test basically tests the change that is made in the code.\nI agree with you that additional tests can be written by re-writing the whole test file in here.","commit_id":"08c41c3e6cc842ec5818d58116eedce553f1ccfb"},{"author":{"_account_id":13770,"name":"Adolfo Duarte","email":"adduarte@redhat.com","username":"adolfoduarte"},"change_message_id":"d703aeea6ed70c61029daa57cfee5061be5a017c","unresolved":false,"context_lines":[{"line_number":500,"context_line":"        }"},{"line_number":501,"context_line":"        router \u003d mock.MagicMock()"},{"line_number":502,"context_line":"        router.extra_attributes.distributed \u003d True"},{"line_number":503,"context_line":"        plugin \u003d mock.MagicMock()"},{"line_number":504,"context_line":"        plugin._get_port.return_value \u003d port"},{"line_number":505,"context_line":"        plugin.get_l3_agents_hosting_routers \u003d mock.Mock("},{"line_number":506,"context_line":"            return_value\u003d[mock.MagicMock()])"}],"source_content_type":"text/x-python","patch_set":9,"id":"7a016987_d9ae872d","line":503,"updated":"2015-05-28 16:27:23.000000000","message":"No action needed. Just nit picking. The mock setup is a bit all over the place here. i.e. sometimes you set the return value sometimes you set the return_value directly. Don\u0027t know if it is a function of the mock library but it would be easier to understand the test if the mocks and cleaned up and all have the same pattern.","commit_id":"8dbe95c3004f1607cbd1b10c34ca4592ec24cf44"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"fb92b5a6097ab54462e30df480f76229951fda5d","unresolved":false,"context_lines":[{"line_number":500,"context_line":"        }"},{"line_number":501,"context_line":"        router \u003d mock.MagicMock()"},{"line_number":502,"context_line":"        router.extra_attributes.distributed \u003d True"},{"line_number":503,"context_line":"        plugin \u003d mock.MagicMock()"},{"line_number":504,"context_line":"        plugin._get_port.return_value \u003d port"},{"line_number":505,"context_line":"        plugin.get_l3_agents_hosting_routers \u003d mock.Mock("},{"line_number":506,"context_line":"            return_value\u003d[mock.MagicMock()])"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa32b979_e5763ed6","line":503,"in_reply_to":"7a016987_d9ae872d","updated":"2015-06-17 19:02:55.000000000","message":"here mock object is not iterable so we need to mock.MagicMock for it to be iterable.","commit_id":"8dbe95c3004f1607cbd1b10c34ca4592ec24cf44"}]}
