)]}'
{"nova/tests/functional/test_nova_manage.py":[{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"e94fb290b79395c5dd80b49a270da94097bfbe31","unresolved":true,"context_lines":[{"line_number":1967,"context_line":"        # The task_log records were created/updated on 2021-08-01, 2021-09-01,"},{"line_number":1968,"context_line":"        # and 2021-10-01. So to archive one record, we need to use"},{"line_number":1969,"context_line":"        # before \u003e 2021-08-01. 2021-07-01 + 31 + 1 \u003d 2021-08-02"},{"line_number":1970,"context_line":"        before \u003d timeutils.utcnow() + datetime.timedelta(days\u003d31 + 1)"},{"line_number":1971,"context_line":"        self.cli.archive_deleted_rows("},{"line_number":1972,"context_line":"            all_cells\u003dTrue, task_log\u003dTrue, before\u003dbefore.isoformat(),"},{"line_number":1973,"context_line":"            verbose\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":1,"id":"e145269e_2333a94b","line":1970,"range":{"start_line":1970,"start_character":57,"end_line":1970,"end_character":68},"updated":"2021-08-02 13:49:31.000000000","message":"This is now two days past what it originally was. I\u0027m not sure I get the logic, and it seems like the nested time fixture above is really the fix for the issue you describe. Was this left in intentionally?\n\nDoesn\u0027t hurt and isn\u0027t wrong, I don\u0027t think, just not related to the failure to reset the time when used nested-ly, as described (AFAICT).","commit_id":"39ef1ad774859562183190f74831a115698e6836"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"c0d79f31ea9abc8ee5eba94e4ae267b428595e13","unresolved":true,"context_lines":[{"line_number":1967,"context_line":"        # The task_log records were created/updated on 2021-08-01, 2021-09-01,"},{"line_number":1968,"context_line":"        # and 2021-10-01. So to archive one record, we need to use"},{"line_number":1969,"context_line":"        # before \u003e 2021-08-01. 2021-07-01 + 31 + 1 \u003d 2021-08-02"},{"line_number":1970,"context_line":"        before \u003d timeutils.utcnow() + datetime.timedelta(days\u003d31 + 1)"},{"line_number":1971,"context_line":"        self.cli.archive_deleted_rows("},{"line_number":1972,"context_line":"            all_cells\u003dTrue, task_log\u003dTrue, before\u003dbefore.isoformat(),"},{"line_number":1973,"context_line":"            verbose\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":1,"id":"c4a2e0da_250bc26a","line":1970,"range":{"start_line":1970,"start_character":57,"end_line":1970,"end_character":68},"in_reply_to":"64dbf681_67c99e96","updated":"2021-08-02 14:54:39.000000000","message":"Okay, I guess I\u0027m not sure why we\u0027d want this (or any) test to be at all dependent on the actual time the test is being run. The fact that you can change the behavior by setting your clock incorrectly means it\u0027s not properly insulated, IMHO.","commit_id":"39ef1ad774859562183190f74831a115698e6836"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"9359e567d1dfea83b2585e2e0a046bc1c9c24cf2","unresolved":true,"context_lines":[{"line_number":1967,"context_line":"        # The task_log records were created/updated on 2021-08-01, 2021-09-01,"},{"line_number":1968,"context_line":"        # and 2021-10-01. So to archive one record, we need to use"},{"line_number":1969,"context_line":"        # before \u003e 2021-08-01. 2021-07-01 + 31 + 1 \u003d 2021-08-02"},{"line_number":1970,"context_line":"        before \u003d timeutils.utcnow() + datetime.timedelta(days\u003d31 + 1)"},{"line_number":1971,"context_line":"        self.cli.archive_deleted_rows("},{"line_number":1972,"context_line":"            all_cells\u003dTrue, task_log\u003dTrue, before\u003dbefore.isoformat(),"},{"line_number":1973,"context_line":"            verbose\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":1,"id":"a55cfe3f_07ff47a3","line":1970,"range":{"start_line":1970,"start_character":57,"end_line":1970,"end_character":68},"in_reply_to":"c4a2e0da_250bc26a","updated":"2021-08-05 23:07:06.000000000","message":"The reason this test depends on time is because, without mocking any database calls, we can only cause multiple task_log records to be generated by advancing time past the last completed audit period:\n\nhttps://github.com/openstack/nova/blob/72c8722e09a47794fc5412a14587a74e79195fca/nova/compute/manager.py#L9539-L9541\n\nIt checks whether a record exists for the utils.last_completed_audit_period() and if one does, it will not write a new record.\n\nIn retrospect, maybe I should have mocked the return values of utils.last_completed_audit_period() to make multiple records be written instead of overriding time. I wanted to test that using --before would archive only a subset of the total records, so I wanted multiple task_log records to be written.\n\nWith regard to the change in the \u0027days\u0027 for testing --before, once the time override restoration was done, the value of --before became 2021-08-01 (2021-07-01 + 31) and the updated_at for the first record is also 2021-08-01, so adding only 31 days exactly would archive nothing for \"before 2021-08-01\". With the bug present (using real utcnow), --before always ended up being later than the first updated_at timestamp of 2021-08-01, so it always archived one record.","commit_id":"39ef1ad774859562183190f74831a115698e6836"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"045655ff41600129388049e5feb1a4a5452ffd67","unresolved":true,"context_lines":[{"line_number":1967,"context_line":"        # The task_log records were created/updated on 2021-08-01, 2021-09-01,"},{"line_number":1968,"context_line":"        # and 2021-10-01. So to archive one record, we need to use"},{"line_number":1969,"context_line":"        # before \u003e 2021-08-01. 2021-07-01 + 31 + 1 \u003d 2021-08-02"},{"line_number":1970,"context_line":"        before \u003d timeutils.utcnow() + datetime.timedelta(days\u003d31 + 1)"},{"line_number":1971,"context_line":"        self.cli.archive_deleted_rows("},{"line_number":1972,"context_line":"            all_cells\u003dTrue, task_log\u003dTrue, before\u003dbefore.isoformat(),"},{"line_number":1973,"context_line":"            verbose\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":1,"id":"64dbf681_67c99e96","line":1970,"range":{"start_line":1970,"start_character":57,"end_line":1970,"end_character":68},"in_reply_to":"e145269e_2333a94b","updated":"2021-08-02 14:42:42.000000000","message":"If I remove the +1 (and set the system clock back to 07.31) then this test fails. So I think this is part of the fix. I think it is about the \u003e instead of \u003e\u003d relation between the task to be archived and the current date. Only adding exactly 31 day to \"today\" make the first task creation date equal to the value of --before. Simply adding a single second  (datetime.timedelta(days\u003d31, seconds\u003d1)) is enough to make the test pass.","commit_id":"39ef1ad774859562183190f74831a115698e6836"}]}
